Piwik/matomo

----------                                                                                                                                                                                                                                    

Install Matomo/piwik on CentOS 7

Piwik is free and open source web analytics tool written in PHP. Piwik uses MySQL/MariaDB to store its data. Piwik is an open source, self hosted alternative of Google analytics providing nearly as many features as Google analytics provides. 

PHP version 7.1 is not available in the default CentOS 7 repositories so we will use the Remi repository.

To install and enable both EPEL and Remi repositories run the following command:

yum install epel-release rpm -Uhv https://rpms.remirepo.net/enterprise/remi-release-7.rpm yum-config-manager --enable remi-php71

You can now proceed and install PHP 7.1 and all necessary PHP modules using the following command:

yum install php php-common php-mbstring php-gd php-curl php-mysql php-xml

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\

[root@www ~]# mysql -u root -p 

Enter password:

# create "piwik" database ( set any password for 'password' )

MariaDB [(none)]> create database piwik; 

MariaDB [(none)]> grant all privileges on piwik.* to piwik@'localhost' identified by 'password1234'; 

MariaDB [(none)]> flush privileges; 

MariaDB [(none)]> exit

[root@www ~]# vi /etc/php.ini

# line 405: increase memory limit

memory_limit = 512M

# wget http://piwik.org/latest.zip -P /var/www/html 

# unzip /var/www/html/latest.zip -d /var/www/html 

# cd /var/www/html 

# mv matomo  piwik

# chown -R apache. /var/www/html/piwik/tmp 

# chown -R apache. /var/www/html/piwik/config 

If SELinux is enabled, change rules like follows.

# setsebool -P httpd_can_network_connect_db on 

# chcon -R -t httpd_sys_rw_content_t /var/www/html/piwik/tmp 

# chcon -R -t httpd_sys_rw_content_t /var/www/html/piwik/config 

# semanage fcontext -a -t httpd_sys_rw_content_t /var/www/html/piwik/tmp 

# semanage fcontext -a -t httpd_sys_rw_content_t /var/www/html/piwik/config 

Auto Archiving

    # crontab -e

    5 * * * * /bin/php /var/www/html/console core:archive --url=http://your-server-IP > /var/log/piwik-archive.log

Access to "

http://(server's hostname or IP address)/piwik/

To see image

https://www.server-world.info/en/note?os=CentOS_7&p=httpd&f=16

-------