How to install matomo on an almalinux vpsThis article discusses how to install Matomo on an AlmaLinux VPS.

What is Matomo?

Matomo (formerly Piwik) is an open-source web analytics platform that allows businesses and website owners to track visitor behavior, monitor site performance, and gain insights into user interactions. It is a privacy-focused alternative to Google Analytics, giving users full control over their data without relying on third-party services.

Key Features of Matomo:

  • Self-Hosted: You can install Matomo on an AlmaLinux VPS server.
  • Privacy Compliance: Matomo is GDPR, HIPAA, and CCPA compliant, making it a preferred choice for privacy-conscious organizations.
  • No Data Sampling: Unlike Google Analytics, Matomo provides 100% accurate data without sampling.
  • Customizable Dashboards: Users can create tailored reports and dashboards.
  • Heatmaps & Session Recordings: It offers visual insights into user behavior on web pages.
  • Conversion Tracking & Funnels: Helps in analyzing marketing campaign performance and user journeys.
  • E-commerce & Goal Tracking: Supports tracking sales, product interactions, and goal completions.

Prerequisites

Before you begin to install Matomo on an AlmaLinux VPS, make sure you have:

Below you will find general recommendations for which instance types to use. While these should work well for most cases, you may need to adjust the instances types to suit your processing workload. Matomo Analytics is designed for speed.

Tracking 100,000 page views per month or less

While Matomo can scale to millions of pages, it is also very efficient to run on a smaller scale, even on a shared hosting account.

  • One server is sufficient to host both the database and app server
  • App server minimum recommended configuration: 2 CPU, 2 GB RAM, 50GB SSD disk.

Tracking 1 million page views per month or less

  • One server can be sufficient to host both the database and app server
  • App server minimum recommended configuration: 4 CPU, 8 GB RAM, 250GB SSD disk.

Tracking 10 million page views per month or less

  • Two servers recommended
    • 1 x App servers, at least 8 CPUs, 16 GB RAM, 100GB SSD disk.
      • Or 2 x App servers, at least 4 CPUs, 4 GB RAM, 100GB SSD disk.
    • 1 x Database server, at least 8 CPUs, 16 GB RAM, 400GB SSD disk.

Launch 100% ssd almalinux vps from $2. 49/mo!

How to Install Matomo on an AlmaLinux VPS

To install Matomo on an AlmaLinux VPS, follow the steps outlined below:

  1. Update Your System

    First, update the system packages to ensure you have the latest versions.

    sudo dnf update -y
  2. Install Apache, MariaDB, and PHP

    Matomo requires a web server, a database, and PHP. For this guide, we’ll use Apache and MariaDB.

    1. Install Apache Web Server

      sudo dnf install httpd -y sudo systemctl enable --now httpd
    2. Install MariaDB Database Server

      sudo dnf install mariadb-server -y sudo systemctl enable --now mariadb

      Secure your database installation:

      sudo mysql_secure_installation

      Follow the prompts to set a root password and remove unnecessary access.

    3. Install PHP and Required Extensions

      Matomo requires PHP 7.4 or later. Install the necessary PHP extensions:

      sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm sudo dnf update && sudo dnf upgrade -y sudo dnf module reset php -y sudo dnf module enable php:remi-8.1 -y sudo dnf install php php-cli php-fpm php-mysqlnd php-gd php-xml php-mbstring php-zip php-curl php-common php-imagick php-bz2 php-intl -y

      Restart Apache to apply changes:

      sudo systemctl restart httpd
  3. Create a Database for Matomo

    Log in to MySQL:

    sudo mysql -u root -p

    Create a database and user:

    CREATE DATABASE matomo; CREATE USER 'matomo_user'@'localhost' IDENTIFIED BY 'strongpassword'; GRANT ALL PRIVILEGES ON matomo.* TO 'matomo_user'@'localhost'; FLUSH PRIVILEGES; EXIT;
  4. Download and Extract Matomo

    Navigate to the web root directory:

    cd /var/www/html

    Download Matomo:

    sudo wget https://builds.matomo.org/matomo-latest.zip

    Extract the archive:

    sudo dnf install unzip -y sudo unzip matomo-latest.zip

    Set correct permissions:

    sudo chown -R apache:apache /var/www/html/matomo sudo chmod -R 755 /var/www/html/matomo
  5. Configure Apache for Matomo

    Create a new virtual host file:

    sudo nano /etc/httpd/conf.d/matomo.conf

    Add the following configuration:

    <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName matomo.raddemo.host DocumentRoot /var/www/html/matomo/ <Directory /var/www/html/matomo> DirectoryIndex index.php Options FollowSymLinks AllowOverride All Require all granted </Directory> <Files "console"> Options None Require all denied </Files> <Directory /var/www/html/matomo/misc/user> Options None Require all granted </Directory> <Directory /var/www/html/matomo/misc> Options None Require all denied </Directory> <Directory /var/www/html/matomo/vendor> Options None Require all denied </Directory> ErrorLog "/var/log/httpd/matomo_error.log" CustomLog "/var/log/httpd/matomo_access.log" combined </VirtualHost>

    Save the file and restart Apache:

    sudo systemctl restart httpd
  6. Complete the Installation via Web Interface

    1. Open a web browser and navigate to http://matomo.raddemo.host/matomo/.
      Matomo install
    2. Follow the on-screen instructions to complete the installation.
      Matomo install complete
    3. Enter the database details created earlier.
    4. Create an admin account and configure settings as needed.
    5. Finish setup and log in to start using Matomo.
      Matomo login
  7. Secure Your Installation

    1. Enable HTTPS

      Install Certbot and configure an SSL certificate:

      sudo dnf install epel-release -y sudo dnf install certbot python3-certbot-apache -y sudo certbot --apache -d matomo.raddemo.host
    2. Configure Firewall

      Allow HTTP and HTTPS traffic:

      sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --permanent --add-service=https sudo firewall-cmd --reload

Launch 100% ssd almalinux vps from $2. 49/mo!

Conclusion

You now know how to install Matomo on an AlmaLinux VPS. You now have a powerful, self-hosted web analytics solution to track and analyze visitor data securely.

Don’t forget to update Matomo and your server regularly to ensure security and optimal performance.

Share this:
Avatar of editorial staff

Editorial Staff

Rad Web Hosting is a leading provider of web hosting, Cloud VPS, and Dedicated Servers in Dallas, TX.
lg