What is Matomo?
Matomo is the ethical alternative where you won't make privacy sacrifices or compromise your site. Matomo's the Google Analytics alternative that protects your data and your customer's privacy. A powerful web analytics platform with 100% data ownership. - https://matomo.org
Installing Matomo
- Log into the Debian device
- Run the following commands in a terminal:
# update software repositories
sudo apt update
# install available updates
sudo apt upgrade -y
# install Apache HTTPD and MySQL
sudo apt install apache2 mariadb-server mariadb-client -y
# install PHP components
sudo apt install php php-curl php-gd php-cli php-mysql php-xml php-mbstring -y
# configure the MySQL database
sudo su
mysql_secure_installation - Press Enter to login as root
- Type Y and press Enter to set a root password, type the password twice to confirm
- Type Y and press Enter to remove anonymous users
- Type Y and press Enter to disallow root login remotely
- Type Y and press Enter to remove the test database
- Type Y and press Enter to reload privilege tables
- Run the following command to login into MySQL:
mysql -u root -p
- Authenticate with the root password set earlier
- Run the following commands to create the Matomo database and database user
CREATE DATABASE analytics;
GRANT ALL ON analytics.* to 'analytics'@'localhost' IDENTIFIED BY 'An@lyt1c$!';
FLUSH PRIVILEGES;
EXIT;
exit - Continue with the following commands to download and extract Matomo in the Apache webroot
# download latest matomo build
wget https://builds.matomo.org/matomo.zip
# extract downloaded zip
sudo unzip matomo.zip -d /var/www/html
# move to webroot
sudo mv /var/www/html/matomo /var/www/html/analytics
# set the owner of the new analytics directory to www-data
sudo chown -R www-data:www-data /var/www/html/analytics - Open a web browser and navigate to http://DNSorIP/analytics
- Click the Next button on the Welcome screen
- Click the Next button on the System Check screen
- Fill in the database connection form as follows and click the Next button
Database Server: 127.0.0.1
Login: analytics
Password: An@lyt1c$!
Database Name: analytics
Table Prefix:
Adapter: MySQLI - Click the Next button
- Create an administrative logon and set the password > Click the Next button
- Complete the form to add the first website to collect analytics on > Click the Next button
- Copy the generated code into the header of the application to monitor
- Click Next > Click Next on the Congratulations page
- Login with the admin logon created earlier
- Welcome to free self-hosted web analytics
Installing Dark Theme (Optional)
- Click the gear icon in the top right
- Select Platform > Marketplace from the left navigation menu
- Change the Show dropdown to Themes and search for Dark Theme
- Find Dark Theme and click the Install button
- Type the admin password to confirm the installation
- Click the Activate Theme button
Source: https://matomo.org/docs/installation/#getting-started