Esta é uma tradução da página de documentação original em inglês. Ajude-nos a torná-la melhor.

1 RHEL/CentOS 7 frontend installation

Overview

The current Zabbix frontend requires PHP version 7.2 or higher. Unfortunately, RHEL/CentOS 7 only provides PHP 5.4 by default. This page describes the proposed method of installing Zabbix frontend on RHEL/CentOS 7.

See also: Updating to PHP 7.3

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.

zabbix-agent.x86_64 : Old Zabbix Agent
       zabbix-get.x86_64 : Zabbix Get
       zabbix-java-gateway.x86_64 : Zabbix java gateway
       zabbix-js.x86_64 : Zabbix JS
       zabbix-proxy-mysql.x86_64 : Zabbix proxy for MySQL or MariaDB database
       zabbix-proxy-pgsql.x86_64 : Zabbix proxy for PostgreSQL database
       zabbix-proxy-sqlite3.x86_64 : Zabbix proxy for SQLite3 database
       zabbix-release.noarch : Zabbix repository configuration
       zabbix-sender.x86_64 : Zabbix Sender
       zabbix-server-mysql.x86_64 : Zabbix server for MySQL or MariaDB database
       zabbix-server-pgsql.x86_64 : Zabbix server for PostgreSQL database

This is due to the fact that frontend packages were moved to a dedicated frontend sub-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 run:

On RHEL

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

On CentOS

# sudo yum install centos-release-scl

On Oracle Linux

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

At this point

# yum list rh-php7\*

Should return a 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-frontend repository.

[zabbix-frontend]
       ...
       enabled=1
       ...

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:

zabbix-nginx-conf-scl.noarch : Zabbix frontend configuration for Nginx (scl version)
       zabbix-web-deps-scl.noarch : Convenience package for installing PHP dependencies of zabbix-web package from redhat software collections
       zabbix-web-mysql-scl.noarch : Zabbix web frontend for MySQL (scl version)
       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. Also install also zabbix-apache-conf-scl or zabbix-nginx-conf-scl package, depending on web server used.

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.

# repoquery --requires zabbix-web-deps-scl
       rh-php72
       rh-php72-php-bcmath
       rh-php72-php-fpm
       rh-php72-php-gd
       rh-php72-php-ldap
       rh-php72-php-mbstring
       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.

# repoquery --requires zabbix-web-mysql-scl
       rh-php72-php-mysqlnd
       zabbix-web
       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.

# repoquery --requires zabbix-web-pgsql-scl
       rh-php72-php-pgsql
       zabbix-web
       zabbix-web-deps-scl

zabbix-apache-conf-scl

This package pulls apache and contains /etc/httpd/cond.d/zabbix.conf file.

# repoquery --requires zabbix-apache-conf-scl
       httpd
       zabbix-web-deps-scl

zabbix-nginx-conf-scl

This package pulls Nginx from Red Hat Software Collections.

# repoquery --requires zabbix-nginx-conf-scl
       rh-nginx116-nginx
       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. For Nginx-specific instructions see Upgrade process with Nginx.

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.

yum remove zabbix-web-*

Install SCL repository

On RHEL run

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

On CentOS run

yum install centos-release-scl

On Oracle Linux run

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

Install Zabbix 5.0 release package and enable zabbix-frontend repository

Install zabbix-release-5.0 package.

rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
       yum clean all

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

[zabbix-frontend]
       ...
       enabled=1
       ...

Install new frontend packages

yum install zabbix-web-mysql-scl zabbix-apache-conf-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**

yum update zabbix-*

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

systemctl restart zabbix-server

** Update remaining services **

Start and enable php-fpm service.

systemctl start rh-php72-php-fpm
       systemctl enable rh-php72-php-fpm

Restart Apache.

systemctl restart httpd

Upgrade process with Nginx

Follow upgrade procedure for apache, described above, but make some adjustments.
A few more steps have to be performed:

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

systemctl stop nginx php-fpm
       systemctl disable nginx php-fpm

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

listen.acl_users = apache,nginx

Make sure zabbix-nginx-conf-scl package is installed instead of zabbix-apache-conf-scl package.

yum install zabbix-nginx-conf-scl

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

#        listen          80;
       #        server_name     example.com;

Start and enable Nginx and php-fpm

systemctl start rh-nginx116-nginx rh-php72-php-fpm
       systemctl enable rh-nginx116-nginx rh-php72-php-fpm