This article covers an installation of Matomo (Piwik), an all-in-one premium web analytics platform, on RHEL 8 Linux Server. In this instance the installation is based on the well-know LAMP stack comprising the RHEL 8, MariaDB, PHP and Apache webserver.
In this tutorial you will learn:
- How to Install LAMP Stack on RHEL 8.
- How to configure MariaDB database.
- How to install Matomo (Piwik) on RHEL 8.
- How to open HTTP and HTTPS firewall ports.
Software Requirements and Conventions Used
Category | Requirements, Conventions or Software Version Used |
---|---|
System | Red Hat Enterprise Linux 8 |
Software | MariaDB Server 10.3.10, PHP 7.2.11-1, Apache/2.4.35 (Red Hat Enterprise Linux) |
Other | Privileged access to your Linux system as root or via the sudo command. |
Conventions |
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
How to install Matomo (Piwik) on RHEL 8 Linux step by step instructions
- Install all prerequisites.
The following command will install all prerequisites and tools required to perform the Matomo (Piwik) installation:
# dnf install php-mysqlnd php-fpm mariadb-server httpd unzip wget php-json php-dom php-gd php-mbstring
- Open HTTP and optionally HTTPS port 80 on your firewall:
# firewall-cmd --permanent --zone=public --add-service=http # firewall-cmd --reload
- Start both the Apache webserver and the MariaDB services:
# systemctl start mariadb # systemctl start httpd
Enable MariaDB and httpd to start after system reboot:
# systemctl enable mariadb # systemctl enable httpd
- (Optional) Secure your MariaDB installation and set root password:
# mysql_secure_installation
- Create a new database
matomo
and give the new useradmin
access to thematomo
database with the passwordpass
:# mysql -u root -p mysql> CREATE DATABASE matomo; mysql> CREATE USER `admin`@`localhost` IDENTIFIED BY 'pass'; mysql> GRANT ALL ON matomo.* TO `admin`@`localhost`; mysql> FLUSH PRIVILEGES; mysql> exit
- Download and extract Matomo (Piwik). Start by downloading the Matomo (Piwik) installation package and extracting its content:
$ wget https://builds.matomo.org/matomo-latest.zip $ unzip matomo-latest.zip
Copy the extracted
matomo
directory into the/var/www/html
directory:# cp -r matomo /var/www/html/
Lastly in this step, change permissions and change file SELinux security context:
# chown -R apache:apache /var/www/html/ # chcon -R -t httpd_sys_rw_content_t /var/www/html/matomo/
- Access Matomo (Piwik) installation wizard and perform the actual Matomo (Piwik) installation. Navigate your browser to
http://localhost/matomo
orhttp://SERVER-HOST-NAME/matomo
and follow the instructions.