This guide walks through a self-hosted installation of Matomo. The latest version is Matomo 5.7.1 (released February 3, 2026), featuring a complete migration to Vue.js 3 and enhanced performance.
For Docker installation, see Docker.
When using Matomo 5.x, note that the platform has migrated to Vue.js 3, which provides improved performance and user experience. The latest version (5.7.1) includes enhanced security features and better plugin compatibility.
mkdir matomo && cd matomo
version: '3.8'
services:
matomo:
image: matomo:5.7.1-apache
restart: unless-stopped
ports:
- "8080:80"
environment:
- MATOMO_DATABASE_HOST=db
- MATOMO_DATABASE_ADAPTER=mysql
- MATOMO_DATABASE_TABLES_PREFIX=matomo_
- MATOMO_DATABASE_USERNAME=matomo
- MATOMO_DATABASE_PASSWORD=matomo_password
- MATOMO_DATABASE_DBNAME=matomo
volumes:
- matomo_data:/var/www/html
depends_on:
- db
db:
image: mysql:8.0
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_DATABASE: matomo
MYSQL_USER: matomo
MYSQL_PASSWORD: matomo_password
volumes:
- matomo_db:/var/lib/mysql
volumes:
matomo_data:
matomo_db:
docker compose up -d
http://your-server-ip:8080 in your browser# For Ubuntu/Debian
sudo apt update
sudo apt install -y apache2 php8.1 php8.1-mysql php8.1-gd php8.1-curl php8.1-xml php8.1-mbstring mysql-server
# For RHEL/CentOS/Rocky Linux
sudo dnf install -y httpd php php-mysqlnd php-gd php-curl php-xml php-mbstring mariadb-server
cd /tmp
wget https://builds.matomo.org/matomo-5.7.1.zip
unzip matomo-5.7.1.zip
sudo mv matomo /var/www/html/matomo
sudo chown -R www-data:www-data /var/www/html/matomo
sudo mysql -u root -p
CREATE DATABASE matomo;
CREATE USER 'matomo'@'localhost' IDENTIFIED BY 'strong_password';
GRANT ALL PRIVILEGES ON matomo.* TO 'matomo'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Create Apache virtual host:
sudo nano /etc/apache2/sites-available/matomo.conf
Add the following configuration:
<VirtualHost *:80>
ServerName matomo.yourdomain.com
DocumentRoot /var/www/html/matomo
<Directory /var/www/html/matomo>
Options -MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/matomo_error.log
CustomLog ${APACHE_LOG_DIR}/matomo_access.log combined
</VirtualHost>
Enable the site and required modules:
sudo a2ensite matomo.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Navigate to your Matomo URL and complete the installation wizard:
For optimal performance, disable browser archiving and set up a cron job:
# Create cron job
sudo nano /etc/cron.d/matomo-archive
# Add the following line (adjust paths as needed):
MAILTO="admin@yourdomain.com"
5 * * * * www-data /usr/bin/php /var/www/html/matomo/console core:archive --url=https://matomo.yourdomain.com > /var/log/matomo-archive.log
Add to your config/config.ini.php:
[General]
browser_archiving_disabled_enforce = 1
In the Matomo admin panel:
Prefer automation? See Matomo Ansible Setup for an example playbook.
Prefer containers? See Matomo Docker Setup.
Any questions?
Feel free to contact us. Find all contact information on our contact page.