Site icon CentLinux

How to install Zabbix on CentOS 8

Share on Social Media

Learn how to install Zabbix on CentOS 8 with our comprehensive step-by-step guide. Set up and configure Zabbix for efficient network monitoring and management. #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:

Zabbix Server Prerequisites:

Zabbix server requires following software packages.

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.

Recommended Training for You: Zabbix Server: Installing and Configuring from Scratch

Zabbix vs LibreNMS

Zabbix and LibreNMS are both powerful network monitoring tools, but they cater to slightly different needs and have distinct features. Here’s a comparison to help you understand the differences and choose the right tool for your needs:

Zabbix

Overview

Features

Pros

Cons

LibreNMS

Overview

Features

Pros

Cons

Conclusion

Both Zabbix and LibreNMS are excellent network monitoring solutions, but your choice depends on your specific needs and expertise:

Assess your specific requirements, the size of your network, and the complexity of your monitoring needs to make the best choice for your environment.

Linux Server Specification

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

Installing 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.

Configure Zabbix – Web Setup

Click on Next Step.

Zabbix Server – Prerequisite Checks

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

Zabbix Server – Configure DB Connection

Enter MySQL Database connectivity parameters and click on Next Step.

Configure Zabbix Server Details

Click on Next Step.

Zabbix Server – Preinstallation Summary

Click on Next Step.

Install Zabbix Server

Click on Finish.

Zabbix Login

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

Zabbix Dashboard

We are reached at the Zabbix Dashboard.

If you want to explore Zabbix software, then we highly recommend you to buy Zabbix 4 Network Monitoring (PAID LINK) by Packt Publishing

Final Thoughts

Installing Zabbix on CentOS 8 can significantly enhance your network monitoring and management capabilities. By following the right steps, you can set up and configure Zabbix to ensure efficient performance and comprehensive oversight of your systems. Whether you’re a system administrator or a network manager, mastering Zabbix will enable you to maintain the health and security of your network infrastructure.

If you need professional assistance or a more detailed guide to install Zabbix on any Linux Distro, I offer expert services on Fiverr. Visit my Fiverr profile: Season Linux Administrator to get personalized help and ensure a smooth and successful installation process.

Exit mobile version