Install dependencies apt install apache2 mariadb-server php libapache2-mod-php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear phpbcmath curl unzip -v sudo systemctl start apache2 sudo systemctl start mariadb Enable and Create db sudo systemctl enable apache2 mariadb CREATE MYSQL DATABASE MYSQL CREATE DATABASE matomodb; CREATE USER 'matomouser'@'localhost' IDENTIFIED BY 'password' GRANT ALL PRIVILAGES ON matomodb.* TO 'matomouser'@'localhost' Pull and unzip Matomo files and set permissions wget http://builds.matomo.org/matomo-latest.zip unzip matomo-latest.zip mv matomo /var/www/html/matomo chown -R www-data:www-data /var/www/html/matomo chmod -R 755 /var/www/html/matomo Create Apache config file sudo nano /etc/apache2/sites-available/matomo.conf ServerName matomo.mark37.com DocumentRoot /var/www/html/matomo/ Options FollowSymLinks Allowoverride All Require all granted Options None Require all denied Options None Required all granted Options None Required all granted Options None Required all granted ErrorLog ${APACHE_LOG_DIR}/matomo_error.log CustomLog ${APACHE_LOG_DIR}/matomo_access.log combined Enable site sudo a2ensite matomo.mark37.com sudo a2enmod rewrite headers enc dif mime setenvif ssl sudo systemctl enable --now php7.4-fpm sudo systemctl reload apache2 Install SSL Certificate sudo apt install certbot python3-certbot-apache -y sudo ufw disable sudo certbot --apache -d matomo.mark37.com sudo ufw enable cron settings for Ssl renew 0 6 * * 0 certbot renew -n -q --pre-hook “systemctl stop apache2” --post-hook “systemctl start apache2”