How to Install and Configure Zabbix Server 5 on Rocky Linux/Alma Linux 8

Zabbix is an open-source monitoring software tool for diverse IT components, including networks, servers, virtual machines and cloud services. Zabbix provides monitoring metrics, among others network utilization, CPU load and disk space consumption. Zabbix has a rich set of features to enable users to monitor more than just hosts, offering great flexibility to administrators when it comes to choosing the most suitable option for each situation.

Zabbix uses XML based template which contains elements to monitor. The backend of Zabbix is written in C programming and PHP is used for the web frontend. **Zabbix **can send you **alerts **to notify the different events and issues based on metrics and thresholds defined for your IT environment. It supports agent-based and agentless monitoring. But Zabbix agents installation can help you to get detailed monitoring e.g. CPU load, network, disk space utilization.

As of the writting of this article, the latest Zabbix version is 5.4. In this guide, we will learn how to install and configure Zabbix on Rocky Linux 8. This guide also works for other RHEL 8 based systems like Oracle Linux 8 and Alma Linux 8.

Related content:

# Table of Content

  1. Ensure that the server is up to date
  2. Install Mariadb
  3. Create mysql user for zabbix
  4. Install PHP and required PHP modules
  5. Install Apache web server
  6. Edit PHP and php-fpm configs for Zabbix
  7. Start and enable php-fpm service
  8. Install Zabbix
  9. Configure SELinux and firewall
  10. Complete Zabbix Installation

# 1. Ensure that the server packages are up to date

Before proceeding, let us make sure that our server packages are up to date with this command:

sudo dnf -y update

Let us also install some common packages that we will need

sudo dnf install -y vim

# 2. Install Mariadb

Zabbix depends on Mysql. Mariadb is a popular Opensource relational management system. It is available in the default repositories as mariadb-server.

Install it with this command:

sudo dnf install -y mariadb-server

Once mariadb is installed, you can confirm the details using this command:

$ rpm -qi mariadb-server
Name        : mariadb-server
Epoch       : 3
Version     : 10.3.28
Release     : 1.module+el8.4.0+427+adf35707
Architecture: x86_64
Install Date: Mon 17 Jan 2022 12:35:21 AM UTC
Group       : Unspecified
Size        : 85968333
License     : GPLv2 with exceptions and LGPLv2 and BSD
Signature   : RSA/SHA256, Mon 31 May 2021 12:18:29 AM UTC, Key ID 15af5dac6d745a60
Source RPM  : mariadb-10.3.28-1.module+el8.4.0+427+adf35707.src.rpm
Build Date  : Sun 30 May 2021 11:56:08 PM UTC
Build Host  :
Relocations : (not relocatable)
Packager    :
Vendor      : Rocky
URL         :
Summary     : The MariaDB server and related files
Description :
MariaDB is a multi-user, multi-threaded SQL database server. It is a
client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. This package contains
the MariaDB server and some accompanying files and directories.
MariaDB is a community developed branch of MySQL.

The Service will not be started by default. Start with this command:

sudo systemctl start mariadb

Confirm the status with this command:

$ 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 Mon 2022-01-17 00:36:02 UTC; 17s ago
     Docs: man:mysqld(8)
  Process: 41146 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
  Process: 41011 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mariadb.service (code=exited, status=0/SUCCESS)
  Process: 40987 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
 Main PID: 41114 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 30 (limit: 23176)
   Memory: 80.2M
   CGroup: /system.slice/mariadb.service
           └─41114 /usr/libexec/mysqld --basedir=/usr

Jan 17 00:36:01 mysql-prepare-db-dir[41011]: See the MariaDB Knowledgebase at or the
Jan 17 00:36:01 mysql-prepare-db-dir[41011]: MySQL manual for more instructions.
Jan 17 00:36:01 mysql-prepare-db-dir[41011]: Please report any problems at
Jan 17 00:36:01 mysql-prepare-db-dir[41011]: The latest information about MariaDB is available at
Jan 17 00:36:01 mysql-prepare-db-dir[41011]: You can find additional information about the MySQL part at:
Jan 17 00:36:01 mysql-prepare-db-dir[41011]:
Jan 17 00:36:01 mysql-prepare-db-dir[41011]: Consider joining MariaDB's strong and vibrant community:
Jan 17 00:36:01 mysql-prepare-db-dir[41011]:
Jan 17 00:36:01 mysqld[41114]: 2022-01-17  0:36:01 0 [Note] /usr/libexec/mysqld (mysqld 10.3.28-MariaDB) starting as process 41114 ...
Jan 17 00:36:02 systemd[1]: Started MariaDB 10.3 database server.

To ensure that mariadb starts on boot, enable it with this systemd command:

sudo systemctl enable mariadb

Once the mysql service is running, you need to secure it. Mysql provides a commandline utility that will do that:

sudo mysql_secure_installation

The above command will take you through prompts to secure and set a root password for the mysql instance.

To confirm the version of MariaDB installed, run the command:

$ mysql -V
mysql  Ver 15.1 Distrib 10.3.28-MariaDB, for Linux (x86_64) using readline 5.1

For more info on how to install and configure mariadb in Rocky Linux check out How to install and Configure Mariadb 10 in Rocky Linux/Alma Linux 8.

# 3. Create mysql user for Zabbix

We are going to create a dedicated user for zabbix. Check out this guide on managing mysql permissions here.

Connect to mysql server:

mysql -u root -p

After Supplying your root password, enter the following to the mysql prompt:

create database zabbix character set utf8 collate utf8_bin;
create user '<meta charset="utf-8">zabbix_user'@'%' identified by 'S0mStrongPa$$word';
grant all privileges on <meta charset="utf-8">zabbix.* to '<meta charset="utf-8">zabbix_user'@'%';

Save the username, db name and password, we will need them later.

Now that we have configured our mysql connection, let’s go to the next section where we install and configure PHP.

# 4. Install PHP and required php modules

The default php version in Rocky Linux might be outdated. To have control over the php version, let us install the Remi release repo using this command:

sudo dnf install

Enable version 7.4 of php

sudo dnf module enable -y php:remi-7.4

You can confirm that the right version is enabled using this command:

sudo dnf module list php

Then install php and dependancies

Next, install the required PHP modules for Zabbix installation.

sudo dnf install -y php \
    php-cli \
    php-common \
    php-fpm \
    php-curl \

Check php version

$ php -v
PHP 7.4.27 (cli) (built: Dec 14 2021 17:17:06) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.27, Copyright (c), by Zend Technologies

For more info on setting up PHP and Apache, check out this guide How to Install Apache and PHP (LAMP stack) on Rocky Linux/Centos 8

# 5. Install Apache Web Server

Next, let us install Apache in our system. Use this command to install Apache web server.

sudo dnf install -y httpd

Apache will be not be started by default. Start with this command:

sudo systemctl start httpd

Check the status using this command:

$ sudo systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2022-01-17 00:50:15 UTC; 1s ago
     Docs: man:httpd.service(8)
 Main PID: 41791 (httpd)
   Status: "Started, listening on: port 80"
    Tasks: 213 (limit: 23176)
   Memory: 32.9M
   CGroup: /system.slice/httpd.service
           ├─41791 /usr/sbin/httpd -DFOREGROUND
           ├─41792 /usr/sbin/httpd -DFOREGROUND
           ├─41793 /usr/sbin/httpd -DFOREGROUND
           ├─41794 /usr/sbin/httpd -DFOREGROUND
           └─41795 /usr/sbin/httpd -DFOREGROUND

Jan 17 00:50:15 systemd[1]: Starting The Apache HTTP Server...
Jan 17 00:50:15 systemd[1]: Started The Apache HTTP Server.
Jan 17 00:50:15 httpd[41791]: Server configured, listening on: port 80

Active: active (running) indicate that the service is now up and running.

To enable the service on boot, use this command:

sudo systemctl enable httpd

# 6. Edit PHP and php-fpm Config for Zabbix

Update the php config to optimize for Zabbix installation.

Open the php ini file

sudo vim /etc/php.ini

Then modify these settings to the values shown. Update the timezone to fit yours.

memory_limit = 2G
max_execution_time = 360
date.timezone = Africa/Nairobi

Next let us edit the php-fpm settings.

sudo vim /etc/php-fpm.d/www.conf

Then update these values

listen = /run/php-fpm/www.sock
user = apache
group = apache

listen.allowed_clients =
listen.owner = apache = apache
listen.mode = 0660
pm = dynamic

Save the changes and exit the file.

Additionally, specify the timezone setting in the Zabbix.conf configuration file.

sudo vim /etc/php-fpm.d/zabbix.conf

Add the line shown. Update to your timezonee.

php_value[date.timezone] = Africa/Nairobi

# 7. Start and enable php-fpm service

The php-fpm service is not started by default. Start using this command:

sudo systemctl start php-fpm

Confirm by checking the status:

$ sudo systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2022-01-11 09:22:55 EAT; 31s ago
 Main PID: 43022 (php-fpm)
   Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
    Tasks: 6 (limit: 23176)
   Memory: 16.0M
   CGroup: /system.slice/php-fpm.service
           ├─43022 php-fpm: master process (/etc/php-fpm.conf)
           ├─43023 php-fpm: pool www
           ├─43024 php-fpm: pool www
           ├─43025 php-fpm: pool www
           ├─43026 php-fpm: pool www
           └─43027 php-fpm: pool www

Jan 11 09:22:55 systemd[1]: Starting The PHP FastCGI Process Manager...
Jan 11 09:22:55 php-fpm[43022]: [11-Jan-2022 09:22:55] WARNING: [pool www] ACL set, listen.owner = 'nginx' is ignored
Jan 11 09:22:55 php-fpm[43022]: [11-Jan-2022 09:22:55] WARNING: [pool www] ACL set, = 'nginx' is ignored
Jan 11 09:22:55 systemd[1]: Started The PHP FastCGI Process Manager.

Enable the service to start on boot

sudo systemctl enable php-fpm

At this point, we have successfully installed the LAMP stack. We can now install Zabbix

# 8. Install Zabbix

Install the zabbix repository

sudo rpm -Uvh

Once the repository is installed, install the Zabbix server, Zabbix agent, and the associated Zabbix packages.

sudo dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-agent

Next, import the database schema:

sudo zcat /usr/share/doc/zabbix-sql-scripts/mysql/create.sql.gz | mysql -u zabbix_user -p zabbix

When prompted for a password, provide the Zabbix user’s password.

Edit Zabbix configuration file and update the db credentials

sudo vim /etc/zabbix/zabbix_server.conf

Ensure that the DBNameDBUserDBPassword values reflect the values you provided for your database



Save the changes and exit the configuration file.

To apply all the changes made, restart all the services as shown

sudo systemctl restart zabbix-server zabbix-agent httpd php-fpm

Additionally, consider enabling them on startup.

sudo systemctl enable zabbix-server zabbix-agent httpd php-fpm

# 9. Configure SELinux & Firewall

If you have firewalld installed and enabled, enable web and Zabbix ports

sudo firewall-cmd --add-port=80/tcp --permanent
sudo firewall-cmd --add-port={10050,10051}/tcp --permanent
sudo firewall-cmd --reload

You will also need to set SELinux to permissive in order to access the frontend from a browser. To do that, run the command:

sudo sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config

# 10. Complete Zabbix Installation

To complete the installation, launch your browser, and go to this URL:


The first page that greets you is the Zabbix welcome page that boldly displays the version you are installing. Select the installation language and click on the ‘Next step’ button.

Citizix - Zabbix welcome page

Citizix – Zabbix welcome page

In the next page you get a list of prerequisites, scroll all the way down and ensure all the prerequisites get the ‘OK’ label in the last column. It’s mandatory that all the requirements are satisfied. Then hit the ‘Next step’ button.

Citizix - Zabbix prerequisites

Citizix – Zabbix prerequisites

On the ‘Configure DB Connection’ page. Fill out your database details. For the database port, leave it at 0. The press ‘Next step’.

Citizix - Zabbix DB configCitizix - Zabbix DB config

Citizix – Zabbix DB config

Then specify your server’s name, confirm your time zone and feel free to select your preferred theme. Then press ‘Next step’.

Citizix - Zabbix Server Details

Citizix – Zabbix Server Details
Citizix - Zabbix Gui Settings
Citizix – Zabbix Gui Settings

Confirm all the settings and if all looks well, press on ‘Next step’ to finalize the installation.

Citizix - Zabbix Preinstall Summary

Citizix – Zabbix Preinstall Summary

If all the settings you provided are correct, you will get a congratulatory message notifying you of the successful setup of Zabbix’s front end. Press on the ‘Finish’ button.

Citizix - Zabbix Install success

Citizix – Zabbix Install success

This directs you to the Zabbix login page. Log in with the following credentials:

Username: Admin
Password: zabbix

Citizix - Zabbix login page

Citizix – Zabbix login page

Then click on ‘Sign in’ to access the Zabbix dashboard. You can change the password later for added security, so don’t worry about that.

Finally, you will get access to Zabbix’s dashboard

Citizix - Zabbix dashboard

Citizix – Zabbix dashboard

 That is it! We have successfully installed the Zabbix monitoring tool on Rocky Linux 8.

Last updated on Mar 20, 2024 17:19 +0300
comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy