Best guide to install Zabbix on CentOS 8

Share on Social Media

Zabbix is a free server based network monitoring software. In this article, you will learn how to install Zabbix on CentOS 8. #centlinux #linux #zabbix

What is Zabbix? :

Zabbix is a free and open-source networking monitoring software. With Zabbix, we can monitor networks, servers, virtual machines and cloud services. Zabbix provides monitoring metrics, among others network utilization, CPU load and disk space consumption.

Zabbix network monitoring software backend is written in C language and web frontend is written in PHP. Zabbix can use MySQL, MariaDB, PostgreSQL, SQLite, Oracle, IBM DB2  to store data.

Zabbix software is developed and maintained by Zabbix LLC and distributed under GPLv2 license.

Read Also: How to install Zabbix on Rocky Linux 9

Zabbix Server Features:

Some of the distinct features of Zabbix are:

  • Distributed monitoring with centralized web administration.
  • Auto-discovery of servers and network devices and interfaces
  • High performance, high capacity (able to monitor hundreds of thousands of devices).
  • SLA, and ITIL KPI metrics on reporting.
  • Native high performance agents (client software for Linux, Solaris, HP-UX, AIX, FreeBSD, OpenBSD, OS X, Tru64/OSF1, Windows 2000, Windows Server 2003, Windows XP, Windows Vista, Windows Server 2008, Windows 7)

Zabbix Server Prerequisites:

Zabbix server requires following software packages.

  • Database Backend  – MySQL Server (5.0.3 – 8.0.x)
  • Web Server – Apache Web Server (1.3.12 or later) 
  • PHP Support (5.4 or later)

Hardware requirements may vary based on the number of devices that you want to monitor via Zabbix server. For complete information about Zabbix requirements, you can visit Zabbix documentation.

Environment Specification:

We have provisioned a CentOS 8 virtual machine for this tutorial.

  • CPU – 3.4 Ghz (2 cores)
  • Memory – 2 GB
  • Storage – 20 GB
  • Operating System – CentOS Linux 8.0
  • Hostname – zabbix-01.recipes.com
  • IP Address – 192.168.116.207 /24

Install LAMP Stack on CentOS 8:

Connect to zabbix-01.recipes.com as root user by using a ssh client.

Zabbix is PHP based network monitoring tool thus requires a PHP application server to run.

Therefore, we are installing Apache web server, MySQL database server and PHP support by using a single dnf command.

# dnf install -y httpd mysql-server php php-mysqlnd php-mbstring php-pdo php-gd

Enable and start Apache service.

# systemctl enable --now httpd.service
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service â /usr/lib/systemd/system/httpd.service.

Allow Apache service to accept incoming traffic in Linux firewall.

# firewall-cmd --permanent --add-service=http ; firewall-cmd --reload
success
success

Enable and start MySQL database service.

# systemctl enable --now mysqld.service
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service â /usr/lib/systemd/system/mysqld.service.

Configure MySQL server instance as follows.

# mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Please set the password for root here.

New password:

Re-enter new password:

Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

Edit PHP configurations to customize it according to your environment.

# vi /etc/php.ini

Uncomment and set following directive.

date.timezone = Asia/Karachi

Install Zabbix Yum Repository:

As described in Zabbix documentation, we can install Zabbix yum repository in our CentOS 8 server as follows.

# cd /tmp
# wget https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm
--2019-12-10 22:32:00--  https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm
Resolving repo.zabbix.com (repo.zabbix.com)... 162.243.159.138, 2604:a880:1:20::b82:1001
Connecting to repo.zabbix.com (repo.zabbix.com)|162.243.159.138|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 17876 (17K) [application/x-redhat-package-manager]
Saving to: âzabbix-release-4.4-1.el8.noarch.rpmâ

zabbix-release-4.4- 100%[===================>]  17.46K  --.-KB/s    in 0s

2019-12-10 22:32:01 (229 MB/s) - âzabbix-release-4.4-1.el8.noarch.rpmâ saved [17876/17876]

Install downloaded RPM by using dnf command.

# dnf install -y zabbix-release-4.4-1.el8.noarch.rpm

Build yum package manager cache for Zabbix yum repository.

# dnf makecache
CentOS-8 - AppStream                            3.8 kB/s | 4.3 kB     00:01
CentOS-8 - Base                                 2.3 kB/s | 3.9 kB     00:01
CentOS-8 - Extras                               546  B/s | 1.5 kB     00:02
Zabbix Official Repository - x86_64             1.7 kB/s | 2.9 kB     00:01
Zabbix Official Repository non-supported - x86_ 2.8 kB/s | 3.0 kB     00:01
Metadata cache created.

Install Zabbix on CentOS 8:

We have setup the Zabbix yum repository, therefore, we can easily install Zabbix on CentOS 8 by using dnf command. Here, we are installing Zabbix with MySQL database support by using following command.

# dnf install -y zabbix-server-mysql

Install Zabbix frontend with MySQL and Apache support.

# dnf -y install zabbix-web-mysql zabbix-apache-conf

Create a MySQL database user to own Zabbix server data.

# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 9
Server version: 8.0.17 Source distribution

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> create database zabbix;
Query OK, 1 row affected (0.04 sec)

mysql> create user 'zabbix'@'localhost' identified by 'Zabbix@1234';
Query OK, 0 rows affected (0.14 sec)

mysql> grant ALL on zabbix.* to 'zabbix'@'localhost';
Query OK, 0 rows affected (0.02 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)

mysql> exit
Bye

Create Zabbix database by using the script provided with Zabbix server installation files.

# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -D zabbix -pZabbix@1234
mysql: [Warning] Using a password on the command line interface can be insecure.

Configure Zabbix server settings.

# vi /etc/zabbix/zabbix_server.conf

And set following directives therein.

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=Zabbix@1234

Configure SELinux settings for Zabbix on CentOS 8. Make sure you have installed policoreutils-python package before executing following commands.

# grep zabbix_t /var/log/audit/audit.log | audit2allow -M zabbix_server_custom
******************** IMPORTANT ***********************
To make this policy package active, execute:

semodule -i zabbix_server_custom.pp

# semodule -i zabbix_server_custom.pp
# rm -f zabbix_server_custom.*
# setsebool -P httpd_can_connect_zabbix on
# setsebool -P httpd_can_network_connect_db on

Enable and start Zabbix service.

# systemctl enable --now zabbix-server
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-server.service â /usr/lib/systemd/system/zabbix-server.service.

We have successfully install Zabbix on CentOS 8.

Install Zabbix Agent on CentOS 8:

Zabbix is agent based server monitoring software. Therefore, we need to install Zabbix agent software on each server that need to be monitored.

Install Zabbix Agent on the same Linux server.

# dnf install -y zabbix-agent

Enable and start Zabbix agent service.

# systemctl enable --now zabbix-agent
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-agent.service â /usr/lib/systemd/system/zabbix-agent.service.

Allow Zabbix agent service ports in Linux firewall.

# firewall-cmd --permanent --add-port={10051/tcp,10050/tcp}
success
# firewall-cmd --reload
success

Open URL http://zabbix-01.recipes.com/zabbix/ in a web browser.

Zabbix Web Setup Welcome Page

Click on Next Step.

Zabbix Web Setup Check for Pre-requisites

Review that all required PHP settings are OK. Click on Next Step.

Zabbix Web Setup Configure DB Connection

Enter MySQL Database connectivity parameters and click on Next Step.

Zabbix Web Setup Server Details

Click on Next Step.

Zabbix Web Setup Pre-installation Summary

Click on Next Step.

Zabbix Web Setup Completed

Click on Finish.

Zabbix Web Login

Login using Zabbix default username/password i.e. admin/zabbix.

Zabbix Dashboard

We are reached at the Dashboard of Zabbix server.

Conclusion – Install Zabbix on CentOS 8:

In this article, you have learned how to install Zabbix on CentOS 8. If you want to explore Zabbix software, then we highly recommend you to buy Zabbix 4 Network Monitoring (PAID LINK) by Packt Publishing.

Scroll to Top