12 C
Texas
angeloma
Senior Writer and partner

Install Matomo on Ubuntu 20.04

Hello, friends. In this post, you will learn how to install Matomo on Ubuntu 20.04. It’s quite useful to measure the traffic to our website or blog.

Matomo is an open-source tool that allows us to measure the traffic of our website. Matomo tracks, in real-time, the web pages seen and visited on a given website. Also, reports are added for analysis.

So, it is a very useful tool for everyone who has a blog or website and now you will learn how to install it.

Install Matomo on Ubuntu 20.04

1.- Install LAMP on Ubuntu 20.04

Matomo has a very friendly web interface built with open source web technologies. Besides this, it requires a relational database manager like MariaDB. That’s why we can use the LAMP- Stack

- Advertisement -

So, read our post about it

How to install LAMP on Ubuntu 20.04?

Also, install the following PHP packages and modules.

php libapache2-mod-php php-cli php-fpm php-json php-pdo php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath unzip wget

2.- Creating a new Database for Matomo

With LAMP already created and configured, the next step is to create a new database and a new user to be used by Matomo to collect the data.

So, open the MariaDB console and start creating the database and user:

CREATE DATABASE matomodb;
GRANT ALL PRIVILEGES ON matomodb.* TO 'matomouser'@'localhost' IDENTIFIED BY 'matomopss';
FLUSH PRIVILEGES;
EXIT;

Now we can start the download

3.- Download Matomo on Ubuntu 20.04

Matomo is distributed in a zip package. This file is the one that we must download and for it, we will use the command wget

cd /tmp
wget https://builds.matomo.org/matomo-latest.zip

Once the installation is finished, it is time to decompress it

sudo unzip matomo-latest.zip -d /var/www/

Then, assign the appropriate permissions and make Apache the owner of the folder.

sudo chown www-data:www-data -R /var/www/matomo/
sudo chmod 755 -R /var/www/matomo/

Now it is time to create a new Virtualhost for Matomo

sudo nano /etc/apache2/sites-available/matomo.conf

And add the following:

<VirtualHost *:80>
     ServerAdmin [email protected]
     ServerName matomo.osradar.test
     DocumentRoot /var/www/matomo/
     
     <Directory /var/www/matomo>
            DirectoryIndex index.php
            Options FollowSymLinks
            AllowOverride All
            Require all granted
     </Directory> 

     <Files "console">
            Options None
            Require all denied
      </Files> 

       <Directory /var/www/matomo/misc/user>
            Options None
            Require all granted
        </Directory>

        <Directory /var/www/matomo/misc>
            Options None
            Require all denied
        </Directory>

        <Directory /var/www/matomo/vendor>
            Options None
            Require all denied
         </Directory>
ErrorLog ${APACHE_LOG_DIR}/matomo_error.log
CustomLog ${APACHE_LOG_DIR}/matomo_access.log combined
</VirtualHost>
1.- Creating a new Virtualhost for Matomo
1.- Creating a new Virtualhost for Matomo

You can change the ServerName and ServerAdmin values to your own without any problem. When you are done, save your changes and close the editor.

Enable the new Virtualhost and restart apache

sudo a2ensite matomo.conf
sudo systemctl restart apache2

4.- Install Matomo on Ubuntu 20.04

Now you have to complete the installation from the web installer. To do this open your favorite web browser and go to http://your-server and you will see the Matomo installer’s welcome screen.

2.- Installing Matomo on Ubuntu 20.04
2.- Installing Matomo on Ubuntu 20.04

Then, your server will be checked to see if it meets all the requirements. At the bottom of the page, click Next.

3.- System check screen
3.- System check screen

Then it’s time to configure the database. To do this, enter the credentials we have created above.

4.- Database configuration
4.- Database configuration

If the connection to the database has worked, you will see the following message.

5.- Connection with the database is correct
5.- Connection with the database is correct

The next step is to create a superuser account. Enter your details and click Next.

6.- Creating the super user account
6.- Creating the super user account

On the next screen, you will be informed that the website has been successfully created. And you can now define your website for the traffic.

7.- Setup the new website
7.- Setup the new website

After this, a JavaScript code will be generated which you will have to copy into your website to monitor it.

8.- Tracking code for osradar
8.- Tracking code for osradar

If all goes well, you will see a message like this

9.- Matomo installed
9.- Matomo installed

Now you only have to log in to Matomo

10.- Matomo login page
10.- Matomo login page

And see the dashboard with everything you can do.

11.- Matomo on Ubuntu 20.04
11.- Matomo on Ubuntu 20.04

Conclusion

Thanks to this post you can install Matomo on a server with Ubuntu 20.04. The process is quite easy to do and has many benefits if you have a website or blog.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article