how to install Matomo on Centos7

Matomo (formerly Piwik) is a free and open source analytics platform. Here i will go through the installation and setup of full server on a Centos 7 machine.

Simple way

Simplest and quickest way is to run the installation script i have created here.

https://github.com/sjoulaei/install-matomo-centos

Please note that the script is not designed to handle all situations and produce errors etc. It is meant to be run on a fresh installation of Centos 7. It will install and configure all you need to run Matomo server.

This should take than 5 minutes to fully install the Matomo server.

Manual Installation

  • Prepare System
  • Install Modules
  • Setup the database
  • Setup matomo from the GUI

 

sudo yum update -y
sudo yum install -y vim wget

sudo yum install centos-release-scl
sudo yum install -y rh-php71-php rh-php71-php-mysqlnd\
 rh-php71-php-mbstring rh-php71-php-dom rh-php71-php-xml rh-php71-php-gd\
 sclo-php71-php-pecl-geoip rh-php71-php-devel\
 httpd24-httpd\
 mariadb-server mariadb
 
sudo systemctl enable httpd24-httpd mariadb
sudo systemctl start mariadb
sudo systemctl start httpd24-httpd
sudo mysql_secure_installation


sudo mkdir /opt/matomo-install
cd /opt/matomo-install
sudo wget https://builds.piwik.org/piwik.tar.gz
sudo tar -xvf piwik.tar.gz

sudo vi /etc/sysconfig/selinux
#change the mode to permissive
sudo reboot

sudo chown -R apache:apache /opt/rh/httpd24/root/var/www/html/matomo
sudo chmod -R 0755 /opt/rh/httpd24/root/var/www/html/matomo/tmp

$ mysql -u root -p
$ mysql> CREATE DATABASE matomo_db;
$ mysql> CREATE USER 'matomo'@'localhost' IDENTIFIED BY 'my-strong-password-here';
$ mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON matomo_db.* TO 'matomo'@'localhost';

 

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.