Matomo is a versatile, open-source web analytics platform that provides comprehensive insights into website traffic and visitor behavior. It helps businesses and website owners track user interactions, conversion rates, and page performance while maintaining control over their data. Unlike proprietary services like Google Analytics, Matomo prioritizes data privacy and security, ensuring compliance with privacy regulations like GDPR. It’s useful for understanding user engagement, optimizing marketing efforts, and improving user experience. Matomo can be customized for individual or business needs, offering real-time analytics, heatmaps, and e-commerce tracking.

Step 1: Access the Dashboard

  • Log in to your Shape.Host account and navigate to your Dashboard.
  • Click the Create button located in the top-right corner.
  • From the dropdown menu, select “Instances” to create a new cloud server.
Shape.host Resources dashboard with Create > Instance highlighted.

Step 2: Select Location

  • You will be prompted to select a data center location for your instance.
  • Choose the location closest to your audience for optimal performance.
Shape.host instance form with the data center location selector highlighted.

Step 3: Choose a Plan

  • Scroll through the available pricing plans.
  • Choose between Standard, CPU-Optimized, or Memory-Optimized based on your needs.

Step 4: Choose an Image

  • Select the operating system for your instance, such as Debian 12.
Shape.host instance form with the operating system image selector highlighted.

Step 5: Authentication and Finalize

  • Choose your authentication method, either via SSH keys or password.
  • Set any additional configurations like hostname.
  • Once ready, click Create Instance.
Shape.host instance form with the Create Instance button highlighted.

Step 6: Obtain IP Address

  • Once your instance is created, return to the dashboard.
  • Find your instance’s IP address under the Resources section and use it to access your server.
Shape.host Resources dashboard with the server IP address highlighted.

To connect to your instance on Shape.Host, follow these steps:

  1. Get the Instance IP: After creating your instance, find the public IP address in the Shape.Host dashboard under Resources.
  2. Open SSH Client: Use an SSH client like Terminal (Linux/macOS) or PuTTY (Windows).
  3. SSH into the Instance: Run the following command in your terminal:
   ssh root@<your-instance-ip>

Replace <your-instance-ip> with your actual instance IP address.

  1. Enter the Password: If prompted, enter your instance’s root password or use your SSH key if configured.

You are now connected to your instance!


Step 7: Update System and Install Required Packages

Run the following commands to update your system and install required packages:

apt update -y
apt install apache2 mariadb-server php php-cli libapache2-mod-php php-common php-curl php-gd php-mbstring php-mysql php-xml php-intl php-zip wget unzip -y
Terminal showing APT package management commands and output.
Terminal showing PM2 application process management output.

Step 8: Start and Enable Apache and MariaDB

Make sure Apache and MariaDB services are running and enabled:

systemctl is-enabled mariadb
systemctl status mariadb
systemctl is-enabled apache2
systemctl status apache2
Terminal showing systemd service management commands or output.
Terminal showing systemd service management commands or output.

Step 9: Check PHP Version

Verify PHP installation with the following command:

php -v

Step 10: Configure PHP Settings

Edit the php.ini file for PHP configuration:

nano /etc/php/8.2/apache2/php.ini

Update the following settings:

date.timezone = Europe/Stockholm
memory_limit = 256M
upload_max_filesize = 16M
max_execution_time = 300

Restart Apache:

systemctl restart apache2
Terminal showing systemd service management commands or output.

Step 11: Secure MariaDB

Run the secure installation script to enhance security:

mariadb-secure-installation
Terminal showing MariaDB/MySQL database security configuration prompts.
Terminal showing mariadb commands or output during Secure MariaDB.

Step 12: Create Matomo Database

Log into MariaDB and create a database for Matomo:

mariadb -u root -p

Execute the following SQL queries:

CREATE DATABASE matomo;
CREATE USER 'matomo'@'localhost' IDENTIFIED BY 'p4ssword';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, INDEX, DROP, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON matomo.* TO 'matomo'@'localhost';
FLUSH PRIVILEGES;
SHOW GRANTS FOR 'matomo'@'localhost';
quit
Terminal showing SQL database and user configuration commands.

Step 13: Download and Extract Matomo

Change to the /var/www/ directory and download Matomo:

cd /var/www/
wget https://builds.matomo.org/matomo.zip
unzip matomo.zip
Terminal showing file and directory setup commands.
Terminal showing file download commands and transfer output.
Terminal showing unzip commands or output during Download and Extract Matomo.

Set the correct permissions:

chown -R www-data:www-data /var/www/matomo
Terminal showing file ownership or permission commands.

Step 14: Configure Apache for Matomo

Create an Apache virtual host configuration file:

nano /etc/apache2/sites-available/matomo.conf

Add the following configuration, making sure to adjust the domain:

<VirtualHost *:80>
    ServerAdmin contact@shape.hsot
    ServerName debian.shape.host
    DocumentRoot /var/www/matomo/

    <Directory /var/www/matomo>
        DirectoryIndex index.php
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    <Files "console">
        Options None
        Require all denied
    </Files>

    <Directory /var/www/matomo/misc/user>
        Options None
        Require all granted
    </Directory>

    <Directory /var/www/matomo/misc>
        Options None
        Require all denied
    </Directory>

    <Directory /var/www/matomo/vendor>
        Options None
        Require all denied
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/matomo_error.log
    CustomLog ${APACHE_LOG_DIR}/matomo_access.log combined

</VirtualHost>
Terminal showing web server configuration text.

Step 15: Enable Apache Site

Enable the Matomo site and restart Apache:

a2ensite matomo.conf
apachectl configtest
systemctl restart apache2
Terminal showing an Apache configuration test.

Step 16: Install SSL Certificates

Install Certbot and secure the site with SSL:

apt install certbot python3-certbot-apache
certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email contact@shape.host -d debian.shape.host
Terminal showing APT package management commands and output.
Terminal showing Certbot certificate commands and messages.

Step 17: Access Matomo in the Browser

Finally, visit https://debian.shape.host/ to complete the Matomo installation via the web interface.

Matomo setup interface.

On the System Check section, ensure your system is ready and click Next again.

Matomo setup interface.

Now input the details, including the MariaDB database name, user, and password, and then click Next to migrate the database.

Matomo installer database connection form.

Once migrated, click Next again.

Matomo setup interface.

Enter a new administrator username, email address, and password for Matomo web analytics.

Matomo installer superuser account form.

Now enter information to create the first tracking with Matomo and click Next.

Matomo setup interface.

Copy the generated tracking code and click Next.

Matomo setup interface.

After the installation is complete, you’ll see the following messages:

Matomo setup interface.

If you visit the Matomo home page, you’ll be redirected to the matomo login page. Enter your admin user, and password, and click SIGN IN.

Matomo sign-in form.

After logging in, you’ll see the following Matomo administration dashboard:

Matomo tracking-method selection screen.

For optimal performance and security when hosting Matomo, consider using Shape.Host’s Linux SSD VPS services for reliable and fast server hosting.