How to Install Matomo Analytics on Ubuntu 20.04

How to Install Matomo Analytics on Ubuntu 20.04

Matomo or previously known as Piwik is open source software for web analytics, which functions to track visitors on the website. Matomo can be an alternative to Google Analytics which wants complete control over data.

System requirements

System requirements for Matomo.

  • Web server Apache, Nginx, IIS, etc
  • PHP version >=5.5.9
  • PHP extension pdo, pdo_mysql, or mysqli
  • MySQL version >=5.5 or MariaDB

Recommended system

  • PHP 7.x
  • PHP GD extension
  • MySQL 5.7+ or MariaDB

Recommended server size

Tracking 100,000 page views per month

  • 1 server for database and app
  • 2 CPU, 2GB RAM, 50GB SSD disk

Tracking 1 million page views per month

  • 1 server for database and app
  • 4 CPU, 8GB RAM, 250GB SSD disk

Tracking 10 million page views per month

  • 1 server for app, 8 CPU, 16GB RAM, 100GB SSD disk
  • or 2 server for app, 4 CPU, 4GB RAM, 100GB SSD disk
  • 1 server for database, 8 CPU, 16GB RAM, 400GB SSD disk

Tracking 100 million page views per month

  • 3 server for app, 16 CPU, 16 RAM, 100GB SSD disk
  • 1 server for database, 16 CPU, 32GB RAM, 1TB SSD disk
  • or optional 2 server for database, one server as replication slave mode
  • 1 load balancer
  • 1 CDN

Tracking 100 million page views per month

  • 3 server for app, 16 CPU, 16GB RAM, 100GB SSD disk
  • 2 server for database, 16 CPU, 32GB RAM, 1TB SSD disk
  • enable replication slave for database
  • 1 load balancer
  • 1 CDN

The system used in the tutorial

  • VPS 1CPU, 2GB RAM, 50GB SSD disk
  • Operating system: Ubuntu 20.04
  • Web server: Apache
  • PHP runtime: PHP 7.4
  • Database: MariaDB 10.3
  • Subdomain: matomo.defnex.com
  • SSL: Let’s Encrypt
  • Matomo: Matomo v3.14.0

Install Apache

Install Apache web server.

Configure a virtual host for matomo.defnex.com.

Virtual host configuration.

Create a DocumentRoot directory.

Enable virtual host.

Restart Apache.

Install Let’s Encrypt SSL

Install certbot for SSL certificates from Let’s Encrypt.

Performs an SSL request for the subdomain matomo.defnex.com.

Install PHP

Install PHP and extensions.

Restart Apache.

Install MariaDB

Install MariaDB database.

Secure MariaDB installation.

Login to MariaDB.

Create a database and user for Matomo.

Install Matomo

Download Matomo.

Extract matomo.zip.

Copy the Matomo files to DocumentRoot.

Change ownership for DocumentRoot.

Browse https://matomo.defnex.com for installation and configuration of Matomo.

Click Next.

Welcome Matomo installation
Welcome Matomo installation

System check, click Next if there are no problems.

System check
System check

To configure the database, enter the database name, username, and password that was created.

Database setup
Database setup

Create a table, click Next.

Creating the tables
Creating the tables

Create a Super User account.

Then Next.

Super user account
Super user account

The first website setup you want to track.

Then Next.

Setup a website
Setup a website

Copy the tracking code that must be installed on the website.

Then Next.

Tracking code
Tracking code

The Matomo installation has been completed.

Click Continue To Matomo.

Matomo installation is completed
Matomo installation is completed

Login using Super User account.

Matomo dashboard
Matomo dashboard

If you found this article helpful and would like to support my work, consider making a donation through PayPal. Your support helps me continue creating useful content and tutorials. Thank you!

Donate via PayPal: https://paypal.me/musaamin

Leave a Reply

Your email address will not be published. Required fields are marked *