How to install Zabbix on Rocky Linux 8 [Step-by-Step]

Zabbix Install and Configure - Overview

Zabbix is an open-source monitoring tool for network devices, servers, applications, hardware appliances, etc. This guide will discuss how to deploy Zabbix 5.0 LTS on Rocky Linux 8.

Zabbix architecture is server-client where the server gets the metrics from the clients which have the Zabbix agents installed on them.  The steps below will highlight how to set up Zabbix on Rocky Linux 8.

Advertisement

 

Lab Environment and Pre-requisites

Below are some of the minimal requirements that are needed before you can set up Zabbix monitoring tool on Rocky Linux instance.

  1. Rocky Linux 8 instance
  2. 2 CPU cores
  3. 4 GB RAM
  4. root user level access

 

Step 1. Install Zabbix 5.0 LTS

Before we can install Zabbix, we need to have the Zabbix repo set up on Rocky Linux 8.

[user@rockylinux ~]$ sudo rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm

Proceed to install Zabbix and some of the required dependencies on Rocky Linux 8:

[user@rockylinux ~]$ sudo dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-apache-conf
Rocky Linux 8 - AppStream                                                1.4 MB/s | 8.7 MB     00:06    
Rocky Linux 8 - BaseOS                                                   2.2 MB/s | 6.5 MB     00:02    
Rocky Linux 8 - Extras                                                   1.5 kB/s | 4.3 kB     00:02    
Zabbix Official Repository - x86_64                                       68 kB/s | 174 kB     00:02    
Zabbix Official Repository non-supported - x86_64                        846  B/s | 1.2 kB     00:01    
Dependencies resolved.
=========================================================================================================
 Package                     Arch    Version                                 Repository             Size
=========================================================================================================
Installing:
 zabbix-agent                x86_64  5.0.15-1.el8                            zabbix                478 k
 zabbix-apache-conf          noarch  5.0.15-1.el8                            zabbix                 19 k
 zabbix-server-mysql         x86_64  5.0.15-1.el8                            zabbix                3.2 M
 zabbix-web-mysql            noarch  5.0.15-1.el8                            zabbix                 18 k
...

 

Step 2. Install PHP and PHP Modules

Install PHP and PHP modules required for Zabbix

Add PHP Remi repo

[user@rockylinux ~]$ sudo dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm

Enable PHP 7.4 module

Advertisement
[user@rockylinux ~]$ sudo dnf module reset php
[user@rockylinux ~]$ sudo dnf module enable php:remi-7.4
[user@rockylinux ~]$ sudo dnf update

Install PHP and PHP Modules

[user@rockylinux ~]$ sudo dnf install php php-fpm  php-gd php-mysqlnd

Verify the installed PHP version:

[user@rockylinux ~]$ php -v
PHP 7.4.23 (cli) (built: Aug 24 2021 16:33:30) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.23, Copyright (c), by Zend Technologies

 

Step 3. Configure PHP-FPM

PHP-FPM is used to serve PHP content to the webserver. Edit the file below and add the content as shown:

[user@rockylinux ~]$ sudo vim /etc/php-fpm.d/www.conf

; listen = 127.0.0.1:9000
listen = /run/php-fpm/www.sock
 
user = apache
group = apache
 
listen.allowed_clients = 0.0.0.0
listen.owner = apache
listen.group = apache
listen.mode = 0660
pm = dynamic

Configure PHP timezone:

[user@rockylinux ~]$ sudo vi /etc/php-fpm.d/zabbix.conf
php_value[date.timezone] = Africa/Nairobi

 

Step 4. Install Apache webserver

Install Apache webserver:

[user@rockylinux ~]$ sudo dnf -y install @httpd

After a successful installation, start and enable the http service:

[user@rockylinux ~]$ sudo systemctl start httpd
[user@rockylinux ~]$ sudo systemctl enable httpd

Verify Apache service status:

[user@rockylinux ~]$ sudo systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/httpd.service.d
           └─php-fpm.conf
   Active: active (running) since Sun 2021-09-12 13:41:35 EDT; 36s ago
     Docs: man:httpd.service(8)
 Main PID: 8001 (httpd)
   Status: "Running, listening on: port 443, port 80"
    Tasks: 213 (limit: 6890)
   Memory: 25.5M
   CGroup: /system.slice/httpd.service
           ├─8001 /usr/sbin/httpd -DFOREGROUND
           ├─8003 /usr/sbin/httpd -DFOREGROUND
           ├─8004 /usr/sbin/httpd -DFOREGROUND
           ├─8005 /usr/sbin/httpd -DFOREGROUND
           └─8006 /usr/sbin/httpd -DFOREGROUND

Sep 12 13:41:35 rockylinux systemd[1]: Starting The Apache HTTP Server...
Sep 12 13:41:35 rockylinux httpd[8001]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::9a7a:c5e0:70de:4954. Set the 'ServerName' directive globally to suppres>
Sep 12 13:41:35 rockylinux systemd[1]: Started The Apache HTTP Server.
Sep 12 13:41:35 rockylinux httpd[8001]: Server configured, listening on: port 443, port 80

 

Step 5. Install MariaDB Server

Follow the steps highlighted in the guide below for installation of MariaDB server on Rocky Linux 8.

Advertisement

Install MariaDB on Rocky Linux 8.4 [Step-by-Step]

Confirm the service status for the database server:

[user@rockylinux ~]$ sudo systemctl status mariadb
● mariadb.service - MariaDB 10.3 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
   Active: active (running) since Sun 2021-09-12 13:44:57 EDT; 1min 2s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 11136 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
  Process: 10999 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mariadb.service (code=exited, status=0/SUCCESS)
  Process: 10975 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
 Main PID: 11102 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 31 (limit: 6890)
   Memory: 83.0M
   CGroup: /system.slice/mariadb.service
           └─11102 /usr/libexec/mysqld --basedir=/usr

Sep 12 13:44:57 rockylinux mysql-prepare-db-dir[10999]: See the MariaDB Knowledgebase at http://mariadb.com/kb or the
Sep 12 13:44:57 rockylinux mysql-prepare-db-dir[10999]: MySQL manual for more instructions.
Sep 12 13:44:57 rockylinux mysql-prepare-db-dir[10999]: Please report any problems at http://mariadb.org/jira
Sep 12 13:44:57 rockylinux mysql-prepare-db-dir[10999]: The latest information about MariaDB is available at http://mariadb.org/.
Sep 12 13:44:57 rockylinux mysql-prepare-db-dir[10999]: You can find additional information about the MySQL part at:
Sep 12 13:44:57 rockylinux mysql-prepare-db-dir[10999]: http://dev.mysql.com
Sep 12 13:44:57 rockylinux mysql-prepare-db-dir[10999]: Consider joining MariaDB's strong and vibrant community:
Sep 12 13:44:57 rockylinux mysql-prepare-db-dir[10999]: https://mariadb.org/get-involved/
Sep 12 13:44:57 rockylinux mysqld[11102]: 2021-09-12 13:44:57 0 [Note] /usr/libexec/mysqld (mysqld 10.3.28-MariaDB) starting as process 11102 ...
Sep 12 13:44:57 rockylinux systemd[1]: Started MariaDB 10.3 database server.

 

Step 6. Configure Zabbix Database

Create the Zabbix database and a user with privileges for the same:

[user@rockylinux ~]$ mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 17
Server version: 10.3.28-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]> CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'P@ssw0rd';
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost' IDENTIFIED BY 'P@ssw0rd';
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> exit;

In the above commands, we have configured the following:

Database: zabbix
db-user: zabbix
db-user-password: P@ssw0rd

 

Step 7. Import Zabbix Database Schema

Import the Zabbix database schema:

[user@rockylinux ~]$ sudo su -

[root@rockylinux ~]# cd /usr/share/doc/zabbix-server-mysql/
[root@rockylinux ~]# zcat create.sql.gz | mysql -u zabbix -p zabbix

You will be prompted to input the password for the zabbix user created in the previous step. In my case, the password is "P@ssw0rd"

 

Step 8. Update database credentials for Zabbix

Configure the credentials for the database as configured in the above steps above:

[user@rockylinux ~]$ sudo vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=P@ssw0rd

 

Step 9. Configure SELinux

Set SELinux to permissive:

[user@rockylinux ~]$ sudo setenforce 0
[user@rockylinux ~]$ sudo sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config

 

Step 10. Configure Firewall

Configure the firewall to allow traffic for Zabbix application

[user@rockylinux ~]$ sudo firewall-cmd --add-service=http --permanent
[user@rockylinux ~]$ sudo firewall-cmd --add-port={10051,10050}/tcp --permanent
[user@rockylinux ~]$ sudo firewall-cmd --reload

Restart Zabbix server and webserver:

[user@rockylinux ~]$ sudo systemctl restart zabbix-server zabbix-agent httpd php-fpm
[user@rockylinux ~]$ sudo systemctl enable zabbix-server zabbix-agent httpd php-fpm

 

Step 11. Configure Zabbix Web

After the above steps, we can now access Zabbix on a web interface to finish up the configuration. Navigate to http://<server-IP>/zabbix

How to install Zabbix on Rocky Linux 8 [Step-by-Step]

 

Click "Next Step" to proceed with the setup.

Confirm that all the required dependencies and parameters have been configured.

How to install Zabbix on Rocky Linux 8 [Step-by-Step]

 

In the next window, input the database details:

How to install Zabbix on Rocky Linux 8 [Step-by-Step]

 

Set the server name, this could be an FQDN or any name for the project.

How to install Zabbix on Rocky Linux 8 [Step-by-Step]

 

In the pre-installation summary window, confirm the details you input in the previous steps.

How to install Zabbix on Rocky Linux 8 [Step-by-Step]

 

Click "Next" to finish the installation:

How to install Zabbix on Rocky Linux 8 [Step-by-Step]

 

A successful installation will redirect you to the login window.

How to install Zabbix on Rocky Linux 8 [Step-by-Step]

 

The default credentials for Zabbix are:

Username: Admin
Password: zabbix

You will then be redirected to the dashboard where you can start adding agents to clients and monitoring them.

How to install Zabbix on Rocky Linux 8 [Step-by-Step]

 

Summary

This guide has demonstrated how to install Zabbix monitoring tool on Rocky Linux 8. As shown, the steps are quite straight-forward and easy to follow. Please feel free to get in touch in the comments section in case you encounter any challenges setting up this solution on Rocky Linux 8.

 

Didn't find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Leave a Comment