Matomo (formerly Piwik) is a powerful open-source web analytics platform that gives you insights into your website's traffic and user behavior. In this guide, we will walk through the steps to install Matomo on Debian 11.
Step 1: Update Your System
Start by ensuring your system is up to date:
sudo apt update && sudo apt upgrade -y
Step 2: Install Required Dependencies
Install the necessary packages, including a web server, PHP, and database server:
sudo apt install -y apache2 php php-mysql libapache2-mod-php php-xml php-curl php-gd php-mbstring php-zip php-json
Step 3: Install MySQL/MariaDB
Install MariaDB to manage your database:
sudo apt install -y mariadb-server
Start and secure your MariaDB installation:
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
Step 4: Create a Database for Matomo
Log into the MariaDB shell:
sudo mysql -u root -p
Run the following commands to create a database and user for Matomo:
CREATE DATABASE matomo;
CREATE USER 'matomouser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON matomo.* TO 'matomouser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Replace your_password
with a strong password for your Matomo user.
Step 5: Download Matomo
Download the latest version of Matomo:
wget https://builds.matomo.org/matomo-latest.zip
Unzip the downloaded file:
unzip matomo-latest.zip
Move the extracted files to the Apache web directory:
sudo mv matomo /var/www/html/
Step 6: Configure Apache for Matomo
Create a new Apache configuration file for Matomo:
sudo nano /etc/apache2/sites-available/matomo.conf
Add the following configuration:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/matomo
<Directory /var/www/html/matomo>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/matomo_error.log
CustomLog ${APACHE_LOG_DIR}/matomo_access.log combined
</VirtualHost>
Step 7: Enable Apache Modules and Site
Enable the necessary Apache modules and the new site configuration:
sudo a2enmod rewrite
sudo a2ensite matomo.conf
sudo systemctl restart apache2
Step 8: Complete Matomo Installation via Web Interface
Open your web browser and navigate to:
http://your_domain_or_ip/matomo
Follow the on-screen instructions to complete the installation. During setup, enter the database details you created earlier.
Conclusion
You have successfully installed Matomo Web Analytics on Debian 11. This powerful analytics platform will help you gain insights into your website traffic and user behavior.
If you're looking for a reliable hosting solution for your Matomo installation, consider using Windows VPS UK. With Windows VPS, you can efficiently host your applications and ensure high performance. Whether you need VPS UK Windows or Windows Virtual Private Servers, you'll find a solution that fits your requirements.
For larger deployments or enterprise needs, explore Windows Virtual Dedicated Server Hosting or Virtual Private Server Hosting Windows. Whether you're located in the UK, Italy, or elsewhere, Windows VPS Italy and UK VPS Windows offer reliable hosting options. Visit Windows VPS Hosting UK to discover the best hosting solutions for your Matomo deployment.