(Last Updated On: March 17, 2019)

How do I install Zabbix Server on RHEL 8 / CentOS 8?. This guide will walk you through the installation and configuration of Zabbix Server on RHEL 8 and coming CentOS 8. Zabbix is a powerful open source monitoring solution used to monitor systems, Network devices, server applications, Hardware appliances, IoT devices, e.t.c. Its backend is written in C and Java while the user web interface written in PHP.

For Cacti: How to install Cacti on RHEL / CentOS 8

Zabbix Architecture (Server & Client)

Zabbix works in a Client/Server model. The server communicates to the native software agents available for various Operating systems like Linux, NIX, and Windows. For systems without an agent, generic monitoring protocols such as Simple Network Management Protocol (SNMP) or Intelligent Platform Management Interface (IPMI) can be used.

Install Zabbix Server on RHEL 8

Zabbix Server depends on the following software applications:

  • MySQL/ MariaDB database server
  • Apache web server
  • PHP with required extensions

MySQL or MariaDB can be a remote server, but php and httpd need to be installed on the Zabbix server. It is possible to run Apache web server in reverse proxy mode.

If you’re not a fan of SELinux, I recommend to you set it in Permissive mode.

sudo setenforce 0
sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
cat /etc/selinux/config | grep SELINUX=

Step 1: Install and Configure Apache Web server

Start with the installation of the Apache Web server. We have a comprehensive guide on how to install Apache httpd on RHEL 8:

How to Install Apache with mod_ssl & mod_http2 on RHEL 8

If you need quick commands to install Apache on RHEL 8, use below

sudo dnf -y install @httpd

Start and enable httpd service to start at boot.

sudo systemctl enable --now httpd

Confirm service status using systemctl command.

$ systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2018-12-29 10:16:00 EAT; 57s ago
Docs: man:httpd.service(8)
Main PID: 31069 (httpd)
Status: "Running, listening on: port 443, port 80"
Tasks: 213 (limit: 11510)
Memory: 31.4M
CGroup: /system.slice/httpd.service
├─31069 /usr/sbin/httpd -DFOREGROUND
├─31070 /usr/sbin/httpd -DFOREGROUND
├─31071 /usr/sbin/httpd -DFOREGROUND
├─31072 /usr/sbin/httpd -DFOREGROUND
└─31073 /usr/sbin/httpd -DFOREGROUND
Dec 29 10:16:00 rhel8.local systemd[1]: Starting The Apache HTTP Server…
Dec 29 10:16:00 rhel8.local httpd[31069]: Server configured, listening on: port 443, port 80
Dec 29 10:16:00 rhel8.local systemd[1]: Started The Apache HTTP Server.

Step 2: Install and Configure PHP

In this section, we install PHP and a number of PHP extensions that are required by Zabbix server. RHEL 8 support both PHP 7.2 and PHP 7.1. The default version installed is 7.2

sudo yum -y install php php-pear php-cgi php-common php-mbstring php-snmp php-gd php-xml php-mysqlnd php-gettext php-bcmath php-json php-ldap

Check current PHP version.

$ php -v
PHP 7.2.11 (cli) (built: Oct 9 2018 15:09:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Start and enable php-fpm service.

sudo systemctl enable --now php-fpm

Confirm service status.

$ sudo systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2018-12-29 10:23:43 EAT; 15s ago
Main PID: 32000 (php-fpm)
Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
Tasks: 6 (limit: 11510)
Memory: 22.7M
CGroup: /system.slice/php-fpm.service
├─32000 php-fpm: master process (/etc/php-fpm.conf)
├─32001 php-fpm: pool www
├─32002 php-fpm: pool www
├─32003 php-fpm: pool www
├─32004 php-fpm: pool www
└─32005 php-fpm: pool www
Dec 29 10:23:43 rhel8.local systemd[1]: Starting The PHP FastCGI Process Manager…
Dec 29 10:23:43 rhel8.local systemd[1]: Started The PHP FastCGI Process Manager.

Set PHP timezone

sudo sed -i "s/^;date.timezone =$/date.timezone = \"Africa\/Nairobi\"/" /etc/php.ini

Replace Africa/Nairobi with your correct timezone and restart httpd after this change:

sudo systemctl restart httpd php-fpm

Step 3: Install MariaDB Database server

Install MariaDB database server using our guide:

How to Install MariaDB on RHEL 8 / CentOS 8

Once Database server is installed, you need to create a database for Zabbix user:

# Export Zabbix DB Password
export zabbix_db_pass="StrongPassword"
mysql -uroot -p <<MYSQL_SCRIPT
    CREATE DATABASE zabbix;
    GRANT ALL PRIVILEGES ON zabbix.* TO [email protected]'localhost' IDENTIFIED BY '${zabbix_db_pass}';
    FLUSH PRIVILEGES;
MYSQL_SCRIPT

Replace “StrongPassword” with your desired password for the database.

Step 4: Install Zabbix Server on RHEL 8

All dependencies we need for Zabbix Server are installed. This last section is for installing and configuring Zabbix server. Download Latest Zabbix Source Archive

Once the file is downloaded, extract it.

tar xvf zabbix-*.gz

Create zabbix group and user account.

sudo groupadd --system zabbix
sudo useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix Monitoring System" zabbix

Import Zabbix Server database schema

For Zabbix server and Zabbix proxy daemons, a database is required. It is not needed to run Zabbix agent. If Zabbix server and proxy are installed on the same host, their databases must be created with different names!

Import initial schema and data for the server with MySQL:

cd zabbix-*/
cd database/mysql/
mysql -u zabbix -p zabbix < schema.sql
mysql -u zabbix -p zabbix < images.sql
mysql -u zabbix -p zabbix < data.sql

Compile and install Zabbix Server

Install build dependencies

sudo dnf -y install gcc make mariadb-devel pcre* libevent-devel libxml2-devel net-snmp-devel libcurl-devel libssh2

Then change to Zabbix source folder.

cd zabbix-*/

Configure the sources for a Zabbix server and agent

./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2

If setting up Zabbix Proxy with SQLite, you’ll run:

./configure --prefix=/usr --enable-proxy --with-net-snmp --with-sqlite3 --with-ssh2

If successful, you should get message like below at the end.

After successful installation configuration, make and install everything.

sudo make install

This process will by default install :

  • daemon binaries – zabbix_server, zabbix_agent and zabbix_proxy in /usr/local/sbin
  • Client binaries (zabbix_get, zabbix_sender) in /usr/local/bin.

Step 5: Configure and start Zabbix server

Create directories for PID and Log files.

sudo mkdir -p /var/log/zabbix /var/run/zabbix/
sudo chown -R zabbix.zabbix /var/log/zabbix /var/run/zabbix

Edit your Zabbix configuration file /usr/local/etc/zabbix_server.conf and set the database name, user and password.

DBName=zabbix
DBUser=zabbix
DBPassword=StrongPassword

Set the PID and Log file paths.

# Change from /tmp/zabbix_server.log
LogFile=/var/log/zabbix/zabbix_server.log

# Change from default /tmp/zabbix_server.pid
PidFile=/var/run/zabbix/zabbix_server.pid

The default parameters should be sufficient for most setup but you can maximize the performance of Zabbix server (or proxy). Check the performance tuning section in the Documentation.

Create Systemd service files

For Zabbix Server.

# Zabbix Server
cat <<EOF | sudo tee /etc/systemd/system/zabbix-server.service
[Unit]
Description=Zabbix Server
After=syslog.target network.target mariadb.service

[Service]
Type=oneshot
User=zabbix
ExecStart=/usr/local/sbin/zabbix_server
ExecReload=/usr/local/sbin/zabbix_server -R config_cache_reload
RemainAfterExit=yes
PIDFile=/var/run/zabbix/zabbix_server.pid

[Install]
WantedBy=multi-user.target
EOF

For Zabbix agent:

# Zabbix Agent
cat <<EOF | sudo tee /etc/systemd/system/zabbix-agent.service
[Unit]
Description=Zabbix Agent
After=syslog.target network.target

[Service]
Type=oneshot
User=zabbix
ExecStart=/usr/local/sbin/zabbix_agentd
RemainAfterExit=yes
PIDFile=/var/run/zabbix/zabbix_agent.pid

[Install]
WantedBy=multi-user.target
EOF

Reload systemd configuration

systemctl daemon-reload

Finally start and set Zabbix services to start at boot.

sudo systemctl enable --now zabbix-server zabbix-agent

Confirm that the services are running.

$ systemctl status zabbix-server zabbix-agent

Step 6: Configure Zabbix Frontend

Change to extracted Zabbix directory.

cd zabbix-*/

Sync files on frontends/php/ to /var/www/html/zabbix

rsync -avP  frontends/php/ /var/www/html/zabbix/

Change directory ownership to apache user and group.

sudo chown -R apache:apache /var/www/html/zabbix/

Adjust PHP parameters in /etc/php.ini.

memory_limit 128M
upload_max_filesize 8M
post_max_size 16M
max_execution_time 300
max_input_time 300
max_input_vars 10000

Allow http and Zabbix service ports on the firewall

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

Open Zabbix URL: http://<server_ip_or_name>/zabbix in your browser.

Confirm that all pre-requisites are satisfied.

Configure DB settings

Provide Server details

Confirm pre-installation summary information.

Finish installation

If you get message like below

Then download the configuration file and place it under in the Zabbix webserver server configuration file – /var/www/html/zabbix/conf/zabbix.conf.php

The default Logins for Zabbix are:

Username: admin
Password: zabbix

You should get to Zabbix dashboard.

Step 7: Change Admin Password

Login to Zabbix admin dashboard with admin user and password zabbix. You need to change the password for admin user after the first login for security reasons.

Navigate to Administration > Users > Admin > Password > Change Password

You now have Zabbix Server on RHEL 8. Our next guide will cover installation and configuration of Zabbix agent.

Zabbix on other systems:

How to Install Zabbix Server 4.0 on CentOS 7

How to Install Zabbix Server 4.0 on Ubuntu 18.04 & Ubuntu 16.04 LTS

How to Install and configure Zabbix agent 4.0 on Ubuntu 18.04 and CentOS 7

Other RHEL 8 monitoring installation guides:

How to install Cacti on RHEL / CentOS 8

How to Install Netdata on RHEL / CentOS 8

Install and Configure Telegraf on RHEL / CentOS 8

How to Install Prometheus on RHEL / CentOS 8

How to Install Grafana on RHEL / CentOS 8