Learn how to set up the Matomo net analytics platform on Ubuntu Server 20.04

Matomo logo
Picture: Matomo

In case you admin web sites, you know the way necessary information evaluation might be. You may must maintain abreast of issues like guests, engines like google and key phrases used, languages spoken, pages favored, downloaded information and extra. That information might be an necessary a part of rising and optimizing your websites and the content material you present.

SEE: Hiring Package: JavaScript Developer (TechRepublic Premium)

One device for that is the open-source Matomo (previously Piwik). Not solely can Matomo maintain you knowledgeable, however it additionally works with Google AdWords, Fb Advertisements, Yahoo, and options cost-per-click evaluation, search advertising and a monitoring and reporting API.

If this seems like one thing you and/or your organization may benefit from, let’s get it put in.

What you’ll want

I’m going to show on Ubuntu Server 20.04, so that you’ll want a operating occasion of that platform, together with a consumer account that has sudo privileges.

Prepared? Let’s do that.

Learn how to set up the dependencies

The very first thing we’ll do is set up the required dependencies. Log into your Ubuntu occasion and set up these packages with the command:

sudo apt-get set up apache2 mariadb-server php libapache2-mod-php php-cli php-fpm php-fpm php-json php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath curl unzip -y

As soon as that set up completes, you’re able to deal with the database.

Learn how to create the database

Earlier than we create the database, let’s begin and allow MariaDB with:

sudo systemctl allow --now mariadb

Subsequent, we have to safe MariaDB. Challenge the command:

sudo secure_mysql_installation

Create a brand new password for the admin consumer after which reply ‘y’ for the remaining questions.

Log in to the MariaDB console with:

sudo mysql

Create the database with:


Create a brand new consumer with:

MariaDB [(none)]> CREATE USER 'matomo'@'localhost' IDENTIFIED BY 'PASSWORD';

The place PASSWORD is a powerful/distinctive password.

Grant the required privileges to the consumer with:

GRANT ALL ON matomodb.* TO 'matomo'@'localhost' WITH GRANT OPTION;

Flush all privileges and exit the database console with:



Learn how to obtain and unpack Matomo

Obtain the most recent model of Matomo with the command:

wget http://builds.matomo.org/matomo-latest.zip

Unpack the file with:

unzip matomo-latest.zip

Transfer the newly created listing into the Apache doc root with:

sudo mv matomo /var/www/html/

Change the permissions and possession with:

sudo chown -R www-data:www-data /var/www/html/matomo

sudo chmod -R 755 /var/www/html/matomo

Learn how to configure Apache

We now flip to the configuration of Apache. Create a brand new .conf file with:

sudo nano /and many others/apache2/sites-available/matomo.conf

In that file, paste the next (modifying as wanted):

<VirtualHost *:80>

ServerAdmin admin@instance.com

ServerName matomo.instance.com

DocumentRoot /var/www/html/matomo/

<Listing /var/www/html/matomo>

DirectoryIndex index.php

Choices FollowSymLinks

AllowOverride All

Require all granted


<Information "console">

Choices None

Require all denied


<Listing /var/www/html/matomo/misc/consumer>

Choices None

Require all granted


<Listing /var/www/html/matomo/misc>

Choices None

Require all denied


<Listing /var/www/html/matomo/vendor>

Choices None

Require all denied


ErrorLog ${APACHE_LOG_DIR}/matomo_error.log

CustomLog ${APACHE_LOG_DIR}/matomo_access.log mixed


Save and shut the file.

Allow the positioning with:

sudo a2ensite matomo.conf

Allow the rewrite module with:

sudo a2enmod rewrite

Restart Apache with:

sudo systemctl restart apache2

Learn how to end the set up

Open an internet browser and level it to http://SERVER/matomo. You can be greeted with the Matomo set up wizard (Determine A).

Determine A

The Matomo installation wizard is simple to complete.
The Matomo set up wizard is easy to finish.

Click on NEXT and the system verify will full. Scroll to the underside and click on NEXT. Within the ensuing window (Determine B), fill out the required data for the database. The login is matomo, the database title is matomodb, and the password is what you set within the MariaDB console. Click on NEXT when completed.

Determine B

Setting the database parameters for Matomo.
Setting the database parameters for Matomo.

As soon as the tables are created, click on Subsequent and also you’ll then be prompted to create a superuser to function the positioning administrator (Determine C).

Determine C

Creating a superuser for Matomo administration purposes.
Making a superuser for Matomo administration functions.

Click on Subsequent and, within the subsequent window (Determine D), you’ll be prompted to arrange an internet site to investigate.

Determine D

Setting up your first site to be analyzed by Matomo.
Organising your first website to be analyzed by Matomo.

Click on Subsequent and also you’ll then be prompted so as to add the required JavaScript monitoring code to your web site. You’ll want so as to add the script earlier than the closing </head> tag on these net pages you need to be analyzed. The monitoring code web page within the wizard offers you loads of directions for doing this. The method will fluctuate, relying on how your web sites have been constructed and who hosts the websites.

Earlier than you click on NEXT, ensure to click on EMAIL THESE INSTRUCTIONS (Determine E) so you have got a reference copy for whenever you really begin including the monitoring code to pages.

Determine E

The tracking code instructions are pretty clear but will vary based on how your sites were built.
The monitoring code directions are fairly clear however will fluctuate based mostly on how your websites have been constructed.

Click on Subsequent after which click on CONTINUE TO MATOMO to lastly attain the precise website, the place you’ll be prompted to log in with the admin account you created. You’ll then be offered with much more directions on find out how to get the monitoring code added to your websites.

And that’s all there may be to getting the Matomo net evaluation platform put in. After this platform is up and operating, you’ll in all probability spend extra time including monitoring code to websites than you probably did putting in the platform. But when information is necessary to you and what you are promoting, the hassle will repay.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the most recent tech recommendation for enterprise professionals from Jack Wallen.

Source link

Be the first to comment

Leave a Reply

Your email address will not be published.