1 RHEL/CentOS 7 frontend installation

Overview

Starting from version 5.0 Zabbix frontend requires PHP version 7.2 or higher. Unfortunately, RHEL/CentOS 7 only provides PHP 5.4. This page describes the proposed method of installing Zabbix frontend 5.0 on RHEL/CentOS 7.

Using PHP and Nginx from Red Hat Software Collections

If you do a clean installation of Zabbix 5.0 using official packages from repo.zabbix.com, you may notice that frontend packages are missing when searching for Zabbix with yum.

  1. zabbix-agent.x86_64 : Old Zabbix Agent
  2. zabbix-get.x86_64 : Zabbix Get
  3. zabbix-java-gateway.x86_64 : Zabbix java gateway
  4. zabbix-js.x86_64 : Zabbix JS
  5. zabbix-proxy-mysql.x86_64 : Zabbix proxy for MySQL or MariaDB database
  6. zabbix-proxy-pgsql.x86_64 : Zabbix proxy for PostgreSQL database
  7. zabbix-proxy-sqlite3.x86_64 : Zabbix proxy for SQLite3 database
  8. zabbix-release.noarch : Zabbix repository configuration
  9. zabbix-sender.x86_64 : Zabbix Sender
  10. zabbix-server-mysql.x86_64 : Zabbix server for MySQL or MariaDB database
  11. zabbix-server-pgsql.x86_64 : Zabbix server for PostgresSQL database

This is due to the fact that frontend packages were moved to a deprecated repository.
However, they can still be installed, if PHP 7.2 dependencies are provided.

For your convenience, any direct dependency on PHP has been removed from the main zabbix-web package. This gives more flexibility in choosing the way to resolve PHP 7.2 dependency.

It is recommended to use PHP packages from Red Hat Software Collections. To enable them:

On RHEL

  1. # yum-config-manager --enable rhel-server-rhscl-7-rpms

On CentOS

  1. # sudo yum install centos-release-scl

On Oracle Linux

  1. # yum install scl-utils
  2. # yum install oraclelinux-release-el7
  3. # /usr/bin/ol_yum_configure.sh
  4. # yum-config-manager --enable software_collections
  5. # yum-config-manager --enable ol7_latest ol7_optional_latest

At this point

  1. # yum list rh-php7\*

Should return list of new rh-php7* packages.

Next, edit /etc/yum.repos.d/zabbix.repo file (if there is no such file, install zabbix-release first). Enable zabbix-deprecated repository.

  1. [zabbix-deprecated]
  2. ...
  3. enabled=1
  4. ...

Replace enabled=0 with enabled=1.

At this stage searching for Zabbix with yum shall return zabbix-web package together with four new packages. These are:

  1. zabbix-nginx-conf-scl.noarch : Zabbix frontend configuration for Nginx (scl version)
  2. zabbix-web-deps-scl.noarch : Convenience package for installing PHP dependencies of zabbix-web package from redhat software collections
  3. zabbix-web-mysql-scl.noarch : Zabbix web frontend for MySQL (scl version)
  4. zabbix-web-pgsql-scl.noarch : Zabbix web frontend for PostgreSQL (scl version)

Install either zabbix-web-mysql-scl for MySQL or zabbix-web-pgsql-scl package for PostgreSQL. If using Nginx, install also zabbix-nginx-conf-scl.

In Zabbix 4.4 support for Nginx was added, but the web server was not available in the official RHEL/CentOS 7 repositories. Thus, it had to be provided by the user via third-party repositores, in particular epel. With Zabbix 5.0, if you choose to use Red Hat Software Collections, there is no need to use any third-party repositories, since Nginx is available in SCL. Simply install zabbix-nginx-conf-scl package.

Technical details of new packages

zabbix-web-deps-scl

This package pulls common PHP dependenencies of Zabbix frontend from Red Hat Software Collections.

  1. # repoquery --requires zabbix-web-deps-scl
  2. rh-php72
  3. rh-php72-php-bcmath
  4. rh-php72-php-fpm
  5. rh-php72-php-gd
  6. rh-php72-php-ldap
  7. rh-php72-php-mbstring
  8. rh-php72-php-xml

It also contains php-fpm pool for Zabbix, since in this configuration frontend works through fastcgi with both Apache and Nginx.
Configuration file is located at /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf.

zabbix-web-mysql-scl

Meta package that pulls zabbix-web package and MySQL module for PHP, together with common PHP dependencies.

  1. # repoquery --requires zabbix-web-mysql-scl
  2. rh-php72-php-mysqlnd
  3. zabbix-web
  4. zabbix-web-deps-scl

zabbix-web-pgsql-scl

Meta package that pulls zabbix-web package and PostgreSQL module for PHP, together with common PHP dependencies.

  1. # repoquery --requires zabbix-web-pgsql-scl
  2. rh-php72-php-pgsql
  3. zabbix-web
  4. zabbix-web-deps-scl

zabbix-nginx-conf-scl

This package pulls Nginx from Red Hat Software Collections.

  1. # repoquery --requires zabbix-nginx-conf-scl
  2. rh-nginx116-nginx
  3. zabbix-web

It also contains Zabbix configuration file for Nginx server at /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf.

Using third party PHP repositories

If for some reasons Red Hat Software Collections can not be used, these alternative methods are available:

  • Using any third-party repository that provides PHP.

  • Building PHP from source.

PHP modules needed for Zabbix frontend are php-gd, php-bcmath, php-mbstring, php-xml, php-ldap and php-json.

Upgrading to Zabbix 5.0 from older versions

Special care must be taken during upgrade to Zabbix 5.0 from previous versions.

Packages from Red Hat Software Collections are designed to avoid conflicts with files from the main repositories.
Every such package is installed into a separate environment dedicated to its group.
For example, packages from rh-php72-php* group have their configuration installed under /etc/opt/rh/rh-php72/ directory, logs are under /var/opt/rh/rh-php72/log/ directory, etc. Services provided by these packages have unusual names such as rh-php72-php-fpm or rh-nginx116-nginx.

Official Zabbix 5.0 frontend packages use php-fpm with both Apache and Nginx.

Upgrade process with Apache

This section provides Apache-specific instructions for upgrading Zabbix frontend and server from version 4.0 or 4.4 to 5.0.
Instructions below are for installing Zabbix with MySQL support. Substitute ‘mysql’ in the commands with ‘pgsql’ to use PostgreSQL

It is assumed that both frontend and server run on the same box. If you have different setup, make adjustments accordingly.

Remove old frontend

Existing Zabbix frontend must be removed before starting an upgrade. Old configuration file will be moved to /etc/httpd/conf.d/zabbix.conf.rpmsave by rpm.

  1. yum remove zabbix-web-*

Install SCL repository

On RHEL run

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

On CentOS run

  1. yum install centos-release-scl

On Oracle Linux run

  1. yum install scl-utils
  2. yum install oraclelinux-release-el7
  3. /usr/bin/ol_yum_configure.sh
  4. yum-config-manager --enable software_collections
  5. yum-config-manager --enable ol7_latest ol7_optional_latest

Install Zabbix 5.0 release package and enable Zabbix-deprecated repository

Install zabbix-release-5.0 package.

  1. rpm -Uvh https://repo.zabbix.com/zabbix/4.5/rhel/7/x86_64/zabbix-release-4.5-2.el7.noarch.rpm
  2. yum clean all

Edit /etc/yum.repos.d/zabbix.repo file. Replace enabled=0 with enabled=1.

  1. [zabbix-deprecated]
  2. ...
  3. enabled=1
  4. ...

Install new frontend packages

  1. yum install zabbix-web-mysql-scl

Official Zabbix 5.0 frontend packages use php-fpm. Update timezone in /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf file.

Update remaining packages and restart Zabbix server

  1. yum update zabbix-*

Restarting Zabbix server will upgrade the database. Make sure the database is backed up.

  1. systemctl restart zabbix-server

Update remaining services

Start and enable php-fpm service.

  1. systemctl start rh-php72-php-fpm
  2. systemctl enable rh-php72-php-fpm

Restart Apache.

  1. systemctl restart httpd

Upgrade process with Nginx

Upgrading to Zabbix 5.0 with Nginx requires few more steps to be performed.

Make sure to stop and disable old Nginx and php-fpm before upgrading. To do this, run:

  1. systemctl stop nginx php-fpm
  2. systemctl disable nginx php-fpm

When editing zabbix.conf file for php-fpm, add user apache to listen.acl_users directive

  1. listen.acl_users = apache,nginx

Install zabbix-nginx-conf-scl package.

  1. yum install zabbix-nginx-conf-scl

Edit /opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf file.
Configure listen and server_name directives.

  1. # listen 80;
  2. # server_name example.com;

Start and enable Nginx and php-fpm

  1. systemctl start rh-nginx116-nginx rh-php72-php-fpm
  2. systemctl enable rh-nginx116-nginx rh-php72-php-fpm