Knowing what is happening in a network is the most frequent work of computer experts in any company. In this way, you get reliable data on the operation and performance of it. This becomes important because it would make the organization’s work more effective and error-free. In this sense, Zabbix is a reference in this type of applications. With them, you will know what is happening in the network. Therefore, in this post, we will teach you how to install Zabbix on CentOS 8 / RHEL 8 / Oracle Linux 8.
What is Zabbix?
Zabbix is quite a wonder. It is an open-source application that works under the client-server architecture. In other words, when installed on any server, it requires an agent to be installed on the client computers. In this way, the application will be able to monitor all the behavior of the nodes as well as the performance of the network.
On the other hand, the development of Zabbix is quite positive and constant, which makes it quite safe and functional. In addition to being quite mature in its development supports several database management systems including the popular MariaDB, MySQL, PostgreSQL or proprietary alternatives such as Oracle and IBM DB2.
In this post, we will install step by step the Zabbix server on CentOS 8 / RHEL 8 / Oracle Linux 8.
Install Zabbix on CentOS 8 / RHEL 8 / Oracle Linux 8
As expected, Zabbix has precompiled binaries available for RHEL 8 and derivatives. These are available from the official repository, but there are some prerequisites we must meet. One of them is that we need a web server running on our computer. Besides that, a database management system like MariaDB.
Install LAMP on CentOS 8 / RHEL 8 / Oracle Linux 8
In this case, we have a complete tutorial where you can install LAMP on CentOS 8 / RHEL 8 / Oracle Linux 8. There, step by step, you will be able to get a web server running as well as the database manager MariaDB.
Read, How to install LAMP on CentOS 8 / RHEL 8 / Oracle Linux 8?
Create the Zabbix user on MariaDB
Once the server is running correctly. It is necessary to create a new user and database for Zabbix. To do this, open the MySQL console and run:
:~# mysql -u root -p > CREATE DATABASE zabbixdb; > GRANT ALL PRIVILEGES ON zabbixdb.* TO 'zabbixuser'@'localhost' IDENTIFIED BY 'zabbixpss'; > FLUSH PRIVILEGES; > exit;
Install Zabbix on CentOS 8 / RHEL 8 / Oracle Linux 8 (I)
Then we can install Zabbix without problems. We will achieve this by using the official Zabbix repository for RHEL 8.
So as a root user, run the following command to add the GPG key from the repository:
:~# rpm --import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX
Then add the repository as such:
:~# rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/8/x86_64/zabbix-release-4.0-2.el8.noarch.rpm
Then proceed to install the Zabbix packages.
:~# dnf install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get zabbix-sender zabbix-java-gateway
If you want you can modify the PHP timezone on the Zabbix configuration file.
:~# nano /etc/httpd/conf.d/zabbix.conf
Uncomment the line date.timezone and add your timezone.
php_value date.timezone [TIMEZONE]
The next step is to load the initial Zabbix database.
:~# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -u zabbixuser -p zabbixdb
Then, it is necessary to specify the database parameters in the Zabbix configuration file.
:~# nano /etc/zabbix/zabbix_server.conf
In this file, you have to modify the following values
DBHost:localhost DBName=[DB_name] DBUser=[Mariadb_zabbix_user] DBPassword=[Password]
Save the changes and close the file. The next step is to open the Zabbix ports in the Firewall so that it can run smoothly.
:~# firewall-cmd --permanent --add-port=10050/tcp success :~# firewall-cmd --permanent --add-port=10051/tcp success :~# firewall-cmd --reload success
Finally, start the service. If you want Zabbix to run at system startup, you can add these commands:
:~# systemctl enable zabbix-server :~# systemctl start zabbix-server :~# systemctl restart httpd
Install Zabbix on CentOS 8 / RHEL 8 / Oracle Linux 8 (II)
The last thing we need to do before we have our Zabbix server running is to complete the installation using the web browser. Open it and go to http://your-server/ you will see this
Then, the installer will check the prerequisites.
Now, we have to set the parameters of the database that we have previously defined.
Then, set up some server details.
In the end, you will see the summary and the message that Zabbix has been successfully installed.
After finishing the process, you will see the login screen. Log in with admin as user and zabbix as password.
Finally, you will see the dashboard. And that is it.
Install the Zabbix agent on the nodes
In order for Zabbix to monitor correctly, it is necessary to install the agents in each of the nodes. Probably, they use different operating systems, so the installation can vary in each of them.
First, you have to add the Zabbix repository for each system. In case you use Ubuntu 18.04:
:~$ wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+bionic_all.deb :~$ sudo dpkg -i zabbix-release_4.0-2+bionic_all.deb :~$ sudo apt update
Then, install Zabbix with the following command:
:~$ sudo apt install zabbix-agent
If you use CentOS 8, add the repository with this command:
:~# rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
Then, install the agent with the following command:
:~# yum install zabbix zabbix-agent
Finally, if you use Debian 9:
:~$ wget https://repo.zabbix.com/zabbix/4.0/debian/pool/main/z/zabbix-release/zabbix-release_4.0-2+stretch_all.deb :~# dpkg -i zabbix-release_4.0-2+stretch_all.deb :~# apt update
And you install it with the command:
:~$ apt install zabbix-agent
Zabbix is an important application in any network service. Thanks to it it is possible to do complete monitoring on the operation of the same one. It also verifies the state of the nodes. In this post, you have learned to install it on the server-side.