Zabbix Documentation 5.0

3.04.04.4 (current)| In development:5.0 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

User Tools

Site Tools


Sidebar

manual:installation:install_from_packages:rhel_centos

1 Red Hat Enterprise Linux/CentOS

Overview

Official Zabbix packages are available for:

  • RHEL 8, CentOS 8 and Oracle Linux 8
  • RHEL 7, CentOS 7 and Oracle Linux 7

In this documentation we will refer to all 3 using the term RHEL.

Some agent and proxy packages are available for RHEL 6 and RHEL 5 as well.

Adding Zabbix repository

Install the repository configuration package. This package contains yum (software package manager) configuration files.

Zabbix 5.0 is not released yet. The links below lead to pre-5.0 packages.

RHEL 8:

# rpm -Uvh https://repo.zabbix.com/zabbix/4.5/rhel/8/x86_64/zabbix-release-4.5-1.el8.noarch.rpm

RHEL 7:

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

RHEL 6:

# rpm -Uvh https://repo.zabbix.com/zabbix/4.5/rhel/6/x86_64/zabbix-release-4.5-1.el6.noarch.rpm

RHEL 5:

# rpm -Uvh https://repo.zabbix.com/zabbix/4.5/rhel/5/x86_64/zabbix-release-4.5-1.el5.noarch.rpm

Frontend installation prerequisites

Zabbix frontend requires additional packages not available in basic installation. You need to enable repository of optional rpms in the system you will run Zabbix frontend on:

RHEL 7:

# yum-config-manager --enable rhel-7-server-optional-rpms

Server/proxy/frontend installation

To install Zabbix server on RHEL 7/8 (deprecated on RHEL 6) with MySQL support:

# yum install zabbix-server-mysql

To install Zabbix proxy with MySQL support:

# yum install zabbix-proxy-mysql

Substitute 'mysql' in the commands with 'pgsql' to use PostgreSQL, or with 'sqlite3' to use SQLite3 (proxy only).

To install Zabbix frontend on RHEL 8 with MySQL/Apache support:

# yum install zabbix-web-mysql zabbix-apache-conf

To install Zabbix frontend on RHEL 7 (deprecated on RHEL 6) with MySQL/Apache support:

# yum install zabbix-web-mysql

To install Zabbix frontend on RHEL 7/8 with MySQL/Nginx support:

# yum install epel-release
# yum install zabbix-web-mysql zabbix-nginx-conf

Note that Nginx for RHEL is available only in EPEL.

Creating database

For Zabbix server and proxy daemons a database is required. It is not needed to run Zabbix agent.

Separate databases are needed for Zabbix server and Zabbix proxy; they cannot use the same database. Therefore, if they are installed on the same host, their databases must be created with different names!

Create the database using the provided instructions for MySQL or PostgreSQL.

Importing data

Now import initial schema and data for the server with MySQL:

# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

You will be prompted to enter your newly created database password.

With PostgreSQL:

# zcat /usr/share/doc/zabbix-server-pgsql*/create.sql.gz | sudo -u <username> psql zabbix

With TimescaleDB, in addition to the previous command, also run:

# zcat /usr/share/doc/zabbix-server-pgsql*/timescaledb.sql.gz | sudo -u <username> psql zabbix
TimescaleDB is supported with Zabbix server only.

For proxy, import initial schema:

# zcat /usr/share/doc/zabbix-proxy-mysql*/schema.sql.gz | mysql -uzabbix -p zabbix

For proxy with PostgreSQL (or SQLite):

# zcat /usr/share/doc/zabbix-proxy-pgsql*/schema.sql.gz | sudo -u <username> psql zabbix
# zcat /usr/share/doc/zabbix-proxy-sqlite3*/schema.sql.gz | sqlite3 zabbix.db

Configure database for Zabbix server/proxy

Edit zabbix_server.conf (and zabbix_proxy.conf) to use their respective databases. For example:

# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=<password>

In DBPassword use Zabbix database password for MySQL; PosgreSQL user password for PosgreSQL.

Use DBHost= with PostgreSQL. You might want to keep the default setting DBHost=localhost (or an IP address), but this would make PostgreSQL use a network socket for connecting to Zabbix. See SELinux configuration below for instructions.

Starting Zabbix server process

To start Zabbix server process on RHEL8:

# service zabbix-server httpd php-fpm start

On RHEL 7:

# service zabbix-server httpd start

On RHEL 7/8 with Nginx:

# service zabbix-server nginx php-fpm start

To make it start at system boot on RHEL 8:

# systemctl enable zabbix-server httpd php-fpm

On RHEL 7:

# systemctl enable zabbix-server httpd

On RHEL 7/8 with Nginx:

# systemctl enable zabbix-server nginx php-fpm

RHEL prior to 7:

# chkconfig --level 12345 zabbix-server on

Substitute 'zabbix-server' with 'zabbix-proxy' if you are installing Zabbix proxy.

Zabbix frontend configuration

Depending on the web server used (Apache/Nginx) edit the corresponding configuration file for Zabbix frontend:

  • For Apache the configuration file is located in /etc/httpd/conf.d/zabbix.conf. Some PHP settings are already configured. Note that in RHEL 7 (but not in RHEL 8) it's necessary to uncomment and set the right date.timezone setting for you.
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value max_input_vars 10000
php_value always_populate_raw_post_data -1
# php_value date.timezone Europe/Riga
  • The zabbix-nginx-conf package installs a separate Nginx server for Zabbix frontend. Its configuration file is located in /etc/nginx/conf.d/zabbix.conf. For Zabbix frontend to work, it's necessary to uncomment and set listen and/or server_name directives.
# listen 80;
# server_name example.com;
  • Zabbix uses its own dedicated php-fpm connection pool:
    • In RHEL 8 with both Apache and Nginx
    • In RHEL 7 only with Nginx

Its configuration file is located in /etc/php-fpm.d/zabbix.conf. Some PHP settings are already configured. But it's necessary to set the right date.timezone setting for you in this file.

php_value[max_execution_time] = 300
php_value[memory_limit] = 128M
php_value[post_max_size] = 16M
php_value[upload_max_filesize] = 2M
php_value[max_input_time] = 300
php_value[max_input_vars] = 10000
; php_value[date.timezone] = Europe/Riga

Now you are ready to proceed with frontend installation steps which will allow you to access your newly installed Zabbix.

Note that a Zabbix proxy does not have a frontend; it communicates with Zabbix server only.

Zabbix official repository provides fping, iksemel, libssh2 packages as well. These packages are located in the non-supported directory.

If you use RHEL 6 please read the section about using Zabbix frontend on RHEL 6 on how to configure the frontend.

SELinux configuration

Having SELinux status enabled in enforcing mode, you need to execute the following commands to enable communication between Zabbix frontend and server:

RHEL 7 and later:

# setsebool -P httpd_can_connect_zabbix on
If the database is accessible over network (including 'localhost' in case of PostgreSQL), you need to allow Zabbix frontend to connect to the database too:
# setsebool -P httpd_can_network_connect_db on

RHEL prior to 7:

# setsebool -P httpd_can_network_connect on
# setsebool -P zabbix_can_network on

As frontend and SELinux configuration is done, you need to restart Apache web server:

# service httpd restart

Zabbix frontend and server on RHEL 6

Zabbix frontend on RHEL 6 is not supported because of PHP version. Since Zabbix 3.0 the requirements are to have PHP 5.4.0 or later while RHEL 6 latest version is 5.3.3 .

In most cases Zabbix server and frontend are installed on the same machine. When upgrading 2.2 to 3.0 Zabbix server will perform database upgrade and frontend will stop working. There is no way to roll back the database changes so users will be forced to upgrade PHP using 3rd party packages. This is why Zabbix server is also deprecated on RHEL 6.

If you still want to use Zabbix frontend on RHEL 6 and upgraded your PHP using 3rd party packages you would need to enable zabbix-deprecated repository first:

  • open file /etc/yum.repos.d/zabbix.repo
  • find section [zabbix-deprecated]
  • set enabled=1
  • save the file

You will have to do some more manual configuration. This is because we cannot identify the Apache version required for your PHP which makes it impossible for us to provide proper Apache configuration for Zabbix frontend. We have included 2 Apache configuration files to our zabbix-web package, one for Apache 2.2 and another for 2.4, which you would need to integrate with the Apache configuration yourself:

  • httpd22-example.conf
  • httpd24-example.conf

To get the full path to the files execute:

$ rpm -ql zabbix-web | grep example.conf

Agent installation

To install the agent, run

# yum install zabbix-agent

To start the agent, run:

# service zabbix-agent start

Substitute 'zabbix-agent' with 'zabbix-agent2' in these commands if using Zabbix agent 2 (only RHEL/CentOS 8).

Java gateway installation

It is required to install Java gateway only if you want to monitor JMX applications. Java gateway is lightweight and does not require a database.

Once the required repository is added, you can install Zabbix Java gateway by running:

# yum install zabbix-java-gateway

Proceed to setup for more details on configuring and running Java gateway.

Installing debuginfo packages

Debuginfo packages are currently available for RHEL/CentOS versions 7, 6 and 5.

To enable debuginfo repository edit /etc/yum.repos.d/zabbix.repo file. Change enabled=0 to enabled=1 for zabbix-debuginfo repository.

[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=http://repo.zabbix.com/zabbix/4.5/rhel/7/$basearch/debuginfo/
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
gpgcheck=1

This will allow you to install the zabbix-debuginfo package.

# yum install zabbix-debuginfo

This single packages contains debug information for all binary Zabbix componets.