How To Install Zabbix Server 5.0 / 4.0 on CentOS 7 / RHEL 7

1

Zabbix is an enterprise-class monitoring solution for servers, network devices, and other components of your infrastructure.

Zabbix uses a client (Zabbix Agent) installed on the monitored client-server to collect the data. Also, it can monitor standard services such as e-mail, web service without installing a client on the monitored devices.

With Zabbix, you can monitor almost everything that is on your infrastructure. Since Zabbix is enterprise-ready, you can use Zabbix monitoring for environments ranging from small to larger.

Zabbix is released under the GPL license.

Features of Zabbix

  • Monitor the metrics like CPU, memory, disk space, network and process of servers (Requires Zabbix Agent)
  • Monitoring of VMware vCenter, VMware hypervisor, and virtual machines.
  • Automatically discover VMware hypervisor and virtual machines using low-level discovery.
  • Monitoring of MySQL, PostgreSQL, Oracle, and Microsoft SQL Server.
  • Zabbix has built-in Java application server monitoring.
  • Monitor network devices with SNMP.
  • Web services monitoring.
  • Hardware monitorings including temperature, fan speed, and disk state.

In this guide, we will see how to install Zabbix Server 5.0 / 4.0 on CentOS 7 / RHEL 7.

System Requirements

Hardware

Zabbix requires at least 128MB memory and 256MB of disk space to start with. However, the amount of memory depends on the number of hosts, and the parameters are being monitored.

2GB RAM and 2GB of disk space would be sufficient to monitor 500 hosts

Software

Zabbix 5.0 (LTS)

Apache: 1.3.12 or later
MySQL: 5.5 or 8.0.x / MariaDB: 10.0.3 or Later
PHP: 7.2.0 or later

Zabbix 4.0 (LTS)

Apache: 1.3.12 or later
MySQL: 5.0.3 or 8.0.x / MariaDB: Latest
PHP: 5.4.0 or later

Install Zabbix on CentOS 7 / RHEL 7

Configure Zabbix repository

Zabbix 5.0 (LTS)

Enable software collection repository on CentOS 7 / RHEL 7.

### RHEL 7 ###

yum-config-manager --enable rhel-server-rhscl-7-rpms

### CentOS 7 ###

yum install -y centos-release-scl

Install the Zabbix repository configuration package to obtain the Zabbix server, agent, and frontend.

rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm

Zabbix 4.0 (LTS)

Install the Zabbix repository configuration package to obtain the Zabbix server, agent, and frontend.

rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm

Install Zabbix Server

Use the following command to install the Zabbix server along with MySQL / MariaDB database support package on your system.

Zabbix 5.0 (LTS)

yum install -y zabbix-web-mysql-scl zabbix-apache-conf-scl zabbix-server-mysql zabbix-agent --enablerepo=zabbix-frontend

Zabbix 4.0 (LTS)

yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent

Timezone

To begin using the Apache with the Zabbix server. Zabbix configuration file needs to be updated with TimeZone.

### Zabbix 5.0 (LTS) ###

vi /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf

### Zabbix 4.0 (LTS) ###

vi /etc/httpd/conf.d/zabbix.conf

Update the below line with the correct timezone. Find more time zones from the official site.

### Zabbix 5.0 (LTS) ###

php_value[date.timezone] = America/New_York

### Zabbix 4.0 (LTS) ###

php_value date.timezone America/New_York

Setup Database

Install MySQL or MariaDB

Install MariaDB or MySQL on your system.

READ: How To Install MariaDB On CentOS 7 / RHEL 7

OR

READ: How To Install MySQL On CentOS 7 / RHEL 7

For this post, I will use the MariaDB database that comes with the operating system.

yum install -y mariadb-server mariadb

Create Database

Start the MariaDB service.

systemctl start mariadb

Login to MariaDB and create the database and user for our Zabbix installation.

If you are starting/setting up the MariaDB server for the first time, then consider taking a look at Securing MariaDB, and this is to ensure the MariaDB instance has a root password set, no anonymous users, disallow root login remotely, and removing test database.
mysql -u root -p

Create a database with the following details.

DBName: zabbixdb
DBUser: zabbixuser
DBPassword: password

create database zabbixdb character set utf8 collate utf8_bin;

grant all privileges on zabbixdb.* to zabbixuser@localhost identified by 'password';

quit;

Once you are done creating the database for Zabbix installation, then import initial schema and data to the newly created database.

cd /usr/share/doc/zabbix-server-mysql*/

zcat create.sql.gz | mysql -u zabbixuser -p zabbixdb

Update Database Configuration

Edit the zabbix_server.conf file to set the database details.

vi /etc/zabbix/zabbix_server.conf

Make sure you set as follows.

DBHost=localhost
DBName=zabbixdb
DBUser=zabbixuser
DBPassword=password

Restart all the services.

### Zabbix 5.0 (LTS) ###

systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm

### Zabbix 4.0 (LTS) ###

systemctl restart zabbix-server zabbix-agent httpd

Enable the service to start automatically on system reboot.

### Zabbix 5.0 (LTS) ###

systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm

### Zabbix 4.0 (LTS) ###

systemctl enable zabbix-server zabbix-agent httpd

SELinux

If you have SELinux enabled on your server, you need to run the following command to enable the successful connection of the Zabbix web frontend to the server.

yum install -y policycoreutils-python

setsebool -P httpd_can_connect_zabbix on

Also, add a few custom rules.

curl https://support.zabbix.com/secure/attachment/53320/zabbix_server_add.te > zabbix_server_add.te

checkmodule -M -m -o zabbix_server_add.mod zabbix_server_add.te

semodule_package -m zabbix_server_add.mod -o zabbix_server_add.pp

semodule -i zabbix_server_add.pp

Thanks to catonrug blog.

Firewall

Configure the firewall to allow the Zabbix agent to reach the Zabbix server.

firewall-cmd --permanent --add-port=10050/tcp

firewall-cmd --permanent --add-port=10051/tcp

firewall-cmd --permanent --add-port=80/tcp

firewall-cmd --reload

Setup Zabbix via Web Installer

Open up your web browser and point it to the following URL.

http://your-ip-add-ress/zabbix/

Follow the below steps to complete the Zabbix installation.

For both versions of Zabbix, Zabbix installation wizard instructions are the same.

Click Next Step on Zabbix welcome page.

Zabbix 5.0 Welcome Screen
Zabbix 5.0 Welcome Screen

This step verifies all the pre-requisites are met for Zabbix Installation. If there are any issues, those need to be fixed. Click on the Next Step.

Zabbix Installation Prechecks
Zabbix Installation Prechecks

Enter the Zabbix database name, DB user, and password. Click the Next Step.

Database Configuration
Database Configuration

Mention the Zabbix server details, port number, and the name for Zabbix installation and then click the Next step.

Zabbix Server Details
Zabbix Server Details

You will get a pre-installation summary like below. Click the Next step.

Zabbix Pre-installation Summary
Zabbix Pre-installation Summary

Now, you have completed the installation of Zabbix. Click the Finish.

Zabbix Installation Completed
Zabbix Installation Completed

Once after you clicked on Finish, the installer will redirect you to the Zabbix web console.

Access Zabbix Dashboard

Log in with the Zabbix default username and password.

Username: Admin

Password: zabbix

Username is case sensitive.
Zabbix Login Page
Zabbix Login Page

Zabbix Dashboard:

Zabbix 5.0 Dashboard
Zabbix 5.0 Dashboard
Zabbix 4.0 Dashboard
Zabbix 4.0 Dashboard

Conclusion

That’s All. Now, you can proceed to install Zabbix Agent and then add client node to Zabbix server for monitoring.

You might also like