Introduction
Matomo (formerly Piwik) is an open-source web analytics platform that helps you track and analyze your website’s performance. In this guide, we’ll walk you through the steps of installing Matomo Web Analytics on a Windows VPS.
Prerequisites
Before you begin, ensure you have the following prerequisites in place:
- A Windows VPS with administrative privileges.
- PHP 7.4 or higher installed on your system.
- MySQL or MariaDB database installed.
- A web server (Apache or Nginx) installed.
- Internet access to download necessary files.
Step 1: Install PHP, MySQL, and a Web Server
If you haven’t already installed the necessary software, follow these steps:
- Install PHP: Download and install PHP from the official website: PHP for Windows.
- Install MySQL or MariaDB: You can install MySQL from MySQL Installer or MariaDB from MariaDB Download.
- Install Apache: Install Apache from the official website: Apache HTTP Server.
- Install Nginx: Install Nginx from the official website: Nginx (optional if you’re using Nginx).
Step 2: Download Matomo
Once you have the necessary software installed, you can now download Matomo:
- Navigate to the official Matomo website: Matomo Downloads.
- Download the latest version of Matomo.
- Extract the downloaded file to your desired installation directory (e.g., C:\inetpub\wwwroot\matomo).
Step 3: Set Up the Database
Matomo requires a MySQL or MariaDB database. Follow these steps to create the database:
- Open the MySQL/MariaDB command line interface:
mysql -u root -p
- Create a new database for Matomo:
CREATE DATABASE matomo;
- Create a user and grant privileges to the Matomo database:
CREATE USER 'matomouser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON matomo.* TO 'matomouser'@'localhost';
- Flush privileges:
FLUSH PRIVILEGES;
- Exit MySQL:
EXIT;
Step 4: Configure Web Server
Next, configure Apache (or Nginx) to serve Matomo:
- For Apache, open your Apache configuration file (usually httpd.conf) and add a virtual host pointing to the Matomo directory:
DocumentRoot "C:/inetpub/wwwroot/matomo" ServerName matomo.example.com <Directory "C:/inetpub/wwwroot/matomo"> AllowOverride All Require all granted
- Restart Apache to apply the changes.
Step 5: Configure Matomo
Before you start using Matomo, configure it by editing the configuration files:
- Open your browser and navigate to http:///matomo or http://matomo.example.com if you’ve configured a domain name.
- The Matomo installation wizard will guide you through the configuration process.
- Follow the prompts, and enter the database information you set up earlier:
Database host: localhost
Database name: matomo
Database user: matomouser
Database password: your_password
- After the configuration, Matomo will finalize the installation.
Step 6: Complete the Setup
Once the installation is complete, you can log into Matomo:
- Visit your Matomo instance in the browser (http:///matomo).
- Log in using the credentials you created during the setup process.
- You can now begin tracking website traffic and analytics.
Conclusion
Congratulations! You’ve successfully installed Matomo Web Analytics on your Windows VPS. You can now monitor your website’s performance and make data-driven decisions to improve user experience.