3 C
Texas
angeloma
Senior Writer and partner

How to install Zabbix server 4 on CentOS 7?

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:

- Advertisement -
:~$ su
:~# yum install httpd php php-mysql php php-mysql php-curl php-json php-cgi php-xml php-mbstring php-bcmath

1.- Install php
1.- Install PHP

Next, create a new file for test PHP.

:~# nano /var/www/html/test.php

And add the following:

<?php
phpinfo();
?>

2.- PHP info
2.- PHP info

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

3.- Set the firewall rule
3.- Set the firewall rule

After that, start and enable the service.

:~# systemctl enable httpd
:~# systemctl start httpd

4.- Start apache web server
4.- Start the Apache web server

Finally, open your web browser and go to http://SERVER_IP/test.php.

5.- PHP info
5.- PHP info

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

6.- Install MariaDB
6.- Install MariaDB

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

7.- mysql_secure_installation script
7.- mysql_secure_installation script

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;

8.- Creating the database for zabbix
8.- Creating the database for Zabbix

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

9.- Add the zabbix repository
9.- Add the Zabbix repository

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

10.- Install Zabbix server 4
10.- Install Zabbix server 4

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

11.- Set the timezone
11.- Set the timezone

Next, import the initial database for Zabbix.

:~# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -u zabbixuser -p zabbixdb

12.- set the initial database for zabbix
12.- set the initial database for Zabbix

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

13.- configure Zabbix
13.- configure Zabbix

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

14.- Set the firewall rule for zabbix
14.- Set the firewall rule for Zabbix

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

15.- Working with the zabbix services
15.- Working with the Zabbix services

16.- Restart apache
16.- Restart apache

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.

17.- Complete the installation
17.- Complete the installation

So, let us start.

First, the wizard will check the prerequisites. Click on next.

18.- prerequisites
18.- prerequisites

Next, configure the database connection. You have to type your credentials.

19.- Configure the database connection
19.- Configure the database connection

Next, configure the server details.

20.- Server details
20.- Server details

After that, you will see the installation summary.

21.- Summary
21.- Summary

You have successfully installed Zabbix.

22.- Everything is OK
22.- Everything is OK

Now, login into the main screen. The user is admin y and the password is Zabbix.

23.- Log in screen
23.- Login screen

And you will see the dashboard.

24.- Dashboard
24.- 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.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article