Debian 11, codenamed Bullseye, is a popular Linux operating system known for its stability and reliability. If you’re running Debian 11, you may be interested in installing Matomo, an open-source web analytics platform, on your system. In this article, we’ll provide a step-by-step guide on how to install Matomo on Debian 11.
Before we begin, it’s important to note that this guide assumes that you have a basic understanding of Linux and the command line. It also assumes that you have already installed a web server (such as Apache) and a database server (such as MySQL) on your system. If you haven’t, you’ll need to do so before proceeding.
With that said, let’s get started.
- Install the Required Dependencies
Before we can install Matomo, we need to make sure that we have all of the necessary dependencies installed on our system. To do this, open a terminal window and run the following command:
sudo apt-get install curl unzip
This command will install curl
, which we’ll use to download the Matomo installation files, and unzip
, which we’ll use to extract those files.
- Download the Matomo Installation Files
Now that we have the required dependencies installed, we can download the Matomo installation files. To do this, run the following command:
curl -O <https://builds.matomo.org/matomo.zip>
This will download the latest version of Matomo to your current working directory.
- Extract the Matomo Installation Files
Next, we need to extract the files from the downloaded matomo.zip
archive. To do this, run the following command:
unzip matomo.zip
This will extract the Matomo files into a new directory called matomo
.
- Move the Matomo Files to the Web Server Root Directory
Next, we need to move the Matomo files to the web server root directory. This is the directory where the web server will look for files to serve when a user accesses your website. By default, the web server root directory on Debian 11 is /var/www/html
.
To move the Matomo files to the web server root directory, run the following command:
sudo mv matomo /var/www/html
This will move the matomo
directory and its contents to the web server root directory.
- Set the Correct Permissions for the Matomo Files
Next, we need to set the correct permissions for the Matomo files. By default, the web server runs under the www-data
user and group, so we need to make sure that this user and group has the necessary permissions to read and write to the Matomo files.
To set the correct permissions for the Matomo files, run the following command:
sudo chown -R www-data:www-data /var/www/html/matomo
This will recursively change the owner and group of all files and directories within the /var/www/html/matomo
directory to www-data
.
- Configure the Web Server
Next, we need to configure the web server to serve the Matomo files. If you’re using Apache as your web server, you’ll need to create a new virtual host configuration file for Matomo.
To do this, open the Apache configuration file (usually located at /etc/apache2/sites-available/000-default.conf
) in a text editor and add the following lines to the end of the file:
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/html/matomo
<Directory /var/www/html/matomo>
AllowOverride All
</Directory>
</VirtualHost>
Be sure to replace example.com
with your own domain name, and save the file when you’re done.
Next, you’ll need to enable the mod_rewrite
Apache module and restart the web server to apply the changes. To do this, run the following commands:
sudo a2enmod rewrite
sudo systemctl restart apache2
This will enable the mod_rewrite
module and restart the Apache web server.
- Run the Matomo Installation Wizard
Now that the web server is configured to serve the Matomo files, you can access the Matomo installation wizard by opening a web browser and navigating to http://example.com/matomo
. This will bring up the Matomo installation wizard, which will guide you through the process of setting up Matomo on your system.
The installation wizard will prompt you to enter information such as your database server credentials, the name of the database to use for Matomo, and the name of the Matomo superuser. Be sure to enter this information accurately and carefully, as it will be necessary for configuring and using Matomo.
Once you have entered all of the required information and completed the installation wizard, Matomo will be installed and ready to use on your system.
Congratulations! You have successfully installed Matomo on your Debian 11 system. You can now log in to the Matomo web interface and start using it to track and analyze your website’s traffic.