Wednesday, July 3, 2024
HomeServerMonitoring & ManagementHow To Install Zabbix Server 5.0 on CentOS 8 / RHEL 8

How To Install Zabbix Server 5.0 on CentOS 8 / RHEL 8

How can one install Zabbix Server 5.0 on CentOS 8 / RHEL 8 Linux?. 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. This guide will walk you through the installation and configuration of Zabbix Server on RHEL 8 / CentOS 8 Linux server

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 5.0 LTS on CentOS 8 / 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:

If you need quick commands to install Apache on RHEL / CentOS 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)
  Drop-In: /usr/lib/systemd/system/httpd.service.d
           └─php-fpm.conf
   Active: active (running) since Tue 2022-10-18 23:02:51 EAT; 6s ago
     Docs: man:httpd.service(8)
 Main PID: 9732 (httpd)
   Status: "Started, listening on: port 443, port 80"
    Tasks: 213 (limit: 49442)
   Memory: 29.3M
   CGroup: /system.slice/httpd.service
           ├─9732 /usr/sbin/httpd -DFOREGROUND
           ├─9734 /usr/sbin/httpd -DFOREGROUND
           ├─9735 /usr/sbin/httpd -DFOREGROUND
           ├─9736 /usr/sbin/httpd -DFOREGROUND
           └─9737 /usr/sbin/httpd -DFOREGROUND

May 16 14:17:29 cent8.neveropen.co.za systemd[1]: Starting The Apache HTTP Server…
May 16 14:17:29 cent8.neveropen.co.za systemd[1]: Started The Apache HTTP Server.
May 16 14:17:29 cent8.neveropen.co.za httpd[9690]: Server configured, listening on: port 443, port 80

Step 2: Install MariaDB Database server

Install MariaDB database server using our guide:

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

$ mysql -u root -p
CREATE DATABASE zabbix character set utf8 collate utf8_bin;
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@'localhost' IDENTIFIED BY 'StrongPassword';
FLUSH PRIVILEGES;
QUIT;

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

Step 3: Install Zabbix Server on CentOS 8 / RHEL 8

All dependencies we need for Zabbix Server are installed. This last section is for installing and configuring Zabbix server on CentOS 8 / RHEL 8.

sudo dnf -y install https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm

Then install Zabbix server packages on CentOS 8 / RHEL 8:

sudo dnf -y install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-agent

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:

sudo su -
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -u zabbix -p zabbix

Step 4: Configure and start Zabbix server

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

$ sudo vi /etc/zabbix/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=StrongPassword

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.

Configure PHP for Zabbix frontend:

Edit file /etc/php-fpm.d/zabbix.conf, uncomment and set the right timezone for you.

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

Finally start and set Zabbix services to start at boot.

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

Confirm that the services are running.

$ systemctl status zabbix-server
● zabbix-server.service - Zabbix Server
    Loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; enabled; vendor preset: disabled)
    Active: active (running) since Tue 2022-10-18 23:06:07 EAT; 6s ago
   Process: 15614 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE (code=exited, status=0/SUCCESS)
  Main PID: 15616 (zabbix_server)
     Tasks: 37 (limit: 11512)
    Memory: 36.2M
    CGroup: /system.slice/zabbix-server.service
            ├─15616 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
            ├─15620 /usr/sbin/zabbix_server: configuration syncer [waiting 60 sec for processes]
            ├─15621 /usr/sbin/zabbix_server: housekeeper [startup idle for 30 minutes]
            ├─15622 /usr/sbin/zabbix_server: timer #1 [updated 0 hosts, suppressed 0 events in 0.003857 sec, idle 59 sec]
            ├─15623 /usr/sbin/zabbix_server: http poller #1 [got 0 values in 0.000690 sec, idle 5 sec]
            ├─15624 /usr/sbin/zabbix_server: discoverer #1 [processed 0 rules in 0.000257 sec, idle 60 sec]
            ├─15625 /usr/sbin/zabbix_server: history syncer #1 [processed 0 values, 0 triggers in 0.000017 sec, idle 1 sec]
            ├─15626 /usr/sbin/zabbix_server: history syncer #2 [processed 1 values, 0 triggers in 0.010668 sec, idle 1 sec]
            ├─15627 /usr/sbin/zabbix_server: history syncer #3 [processed 0 values, 0 triggers in 0.000042 sec, idle 1 sec]
            ├─15628 /usr/sbin/zabbix_server: history syncer #4 [processed 0 values, 0 triggers in 0.000018 sec, idle 1 sec]
            ├─15629 /usr/sbin/zabbix_server: escalator #1 [processed 0 escalations in 0.000469 sec, idle 3 sec]

$ systemctl status  zabbix-agent
 ● zabbix-agent.service - Zabbix Agent
    Loaded: loaded (/usr/lib/systemd/system/zabbix-agent.service; enabled; vendor preset: disabled)
    Active: active (running) since Tue 2022-10-18 23:06:07 EAT; 32s ago
  Main PID: 15567 (zabbix_agentd)
     Tasks: 6 (limit: 11512)
    Memory: 4.6M
    CGroup: /system.slice/zabbix-agent.service
            ├─15567 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
            ├─15569 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
            ├─15570 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
            ├─15571 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
            ├─15572 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
            └─15573 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
 Oct 18 23:06:07 centos8.novalocal systemd[1]: Starting Zabbix Agent…
 Oct 18 23:06:07 centos8.novalocal systemd[1]: Started Zabbix Agent.

Step 5: Configure Zabbix Frontend

Adjust PHP parameters in /etc/php.ini.

$ sudo vi /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

Restart httpd and php-fpm service.

sudo systemctl restart httpd php-fpm

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

zabbix 5 web 1

Confirm that all pre-requisites are satisfied.

install zabbix centos 7 01

Configure DB settings

zabbix setup 03

Provide Server details

zabbix setup 04

Confirm pre-installation summary information.

zabbix setup 05

Finish installation

set zabbix frontend finish installation

If you get message like below

set zabbix save configuration

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.

zabbix 5 web 7 dashboard

Step 6: Change Zabbix 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

zabbix rhel8 change password

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

Zabbix on other systems:

How to Install Zabbix Server on CentOS 7

How to Install Zabbix Server on Ubuntu

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

Thapelo Manthata
I’m a desktop support specialist transitioning into a SharePoint developer role by day and Software Engineering student by night. My superpowers include customer service, coding, the Microsoft office 365 suite including SharePoint and power platform.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments