The monitoring of a series of services is something fundamental for an organization. That’s why there are many stellar applications that help us with the same thing. Zabbix is one of them and recently saw the release of version 4 of this fantastic application. With this in mind, today I will show you how to install Zabbix Server 4 on CentOS 7.
In this site, we have already talked about Zabbix, this fantastic application that serves to monitor various services within a network. However, it is not only limited to services but also to specific nodes. So, it is open source with all the advantages we can have over it and also has agents available for various systems.
So, let us start to install Zabbix server 4.
1. Install Apache web server and PHP
Zabbix Server has a quite nice web interface that can be accessed from the clients. This interface requires a web server and PHP. Therefore, the first step in this guide is to install them both. Open a terminal and run:
:~$ su :~# yum install httpd php php-mysql php php-mysql php-curl php-json php-cgi php-xml php-mbstring php-bcmath
Next, create a new file for test PHP.
:~# nano /var/www/html/test.php
And add the following:
<?php phpinfo(); ?>
Then, it is necessary to add the rules to the firewall to allow Apache and PHP access.
:~# firewall-cmd --permanent --add-service=http :~# firewall-cmd --reload
After that, start and enable the service.
:~# systemctl enable httpd :~# systemctl start httpd
Finally, open your web browser and go to http://SERVER_IP/test.php
.
Now, Apache and PHP are correctly installed.
2. Install and configure MariaDB
The way Zabbix manages data efficiently is thanks to a robust and reliable database handler. Zabbix allows the use of MySQL, MariaDB, and PostgreSQL. For now, I will use MariaDB. So, the next step is to install and configure it.
:~# yum install mariadb-server
After that, star and enable the MariaDB service:
:~# systemctl enable mariadb :~# systemctl start mariadb
Now, set a root the password using the mysql_secure_installation
script.
:~# mysql_secure_installation
As you can see, there are several parameters that you can configure. In the case of this tutorial, you can answer as you want because it does not affect anything. However, I recommend you read them carefully and make the best decision. In my case, I have answered Y, N, Y, Y.
After that, it is necessary to create a database and user for Zabbix.
:~# mysql -u root -p CREATE DATABASE zabbixdb; GRANT ALL PRIVILEGES ON zabbixdb.* TO 'zabbixuser'@'localhost' IDENTIFIED BY 'zabbixpss'; FLUSH PRIVILEGES; exit;
3. Install Zabbix Server 4
There is a fairly simple way to install Zabbix server 4. It is to do it through an external repository and then use yum. So let us go for it.
:~# rpm --import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX :~# rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
Next, install Zabbix 4 agent and others required packages.
:~# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get zabbix-sender zabbix-java-gateway
Now, edit the PHP timezone on the Zabbix configuration file.
:~# nano /etc/httpd/conf.d/zabbix.conf
And uncomment the “date.timezone” setting and replace it with your timezone:
php_value date.timezone YOURTIMEZONE
Next, import the initial database for Zabbix.
:~# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -u zabbixuser -p zabbixdb
After that, you have to specify the databases parameters on the Zabbix configuration.
:~# nano /etc/zabbix/zabbix_server.conf
DBHost=localhost DBName=zabbixdb DBUser=zabbixuser DBPassword=YOUR_PASSWORD
Next, set the firewall rule for Zabbix.
:~# firewall-cmd --permanent --zone=public --add-port=10051/tcp :~# firewall-cmd --permanent --zone=public --add-port=10050/tcp :~# firewall-cmd --reload
Finally, enable and start the Zabbix services.
:~# systemctl enable zabbix-server :~# systemctl start zabbix-server :~# systemctl enable zabbix-server :~# systemctl start zabbix-server :~# systemctl restart httpd
After that, complete the installation.
4. Complete the installation
Now, open your web browser and go to http://SERVER_IP/zabbix and you will see this.
So, let us start.
First, the wizard will check the prerequisites. Click on next.
Next, configure the database connection. You have to type your credentials.
Next, configure the server details.
After that, you will see the installation summary.
You have successfully installed Zabbix.
Now, login into the main screen. The user is admin y and the password is Zabbix.
And you will see the dashboard.
So, that’s it.
Conclusion
With this Zabbix is installed. This wonderful monitoring program, what remains is to install the agent in each of the nodes you want to visualize.
Its installation is quite simple and only requires a little time and knowledge.
Please share this article with your friends.