Sunday, November 22, 2026
TR
Open Source

Zabbix – Upgrading to the Latest 7.0 LTS Release

Zabbix – Upgrading to the Latest 7.0 LTS Release
Contents
  1. Preparation Steps
  2. Version Check
  3. Backing Up the Zabbix Configuration Files
  4. Stopping the Services
  5. PHP Update
  6. Database Update
  7. Updating Zabbix
  8. Performance Tuning After the PostgreSQL Upgrade
  9. Final Steps

Preparation Steps

  • Read the "release notes" [Official release notes for Zabbix 7.0 LTS] .
  • Read the "upgrade notes" [Official upgrade notes for Zabbix 7.0 LTS] thoroughly.
  • Check and optimize the performance of the existing database according to vendor recommendations and Zabbix server requirements.
  • Make sure the versions of all components match the compatibility matrix of the new Zabbix version.
  • Back up the configuration files of the Zabbix server and Zabbix proxy.
  • Back up the databases of the Zabbix server and, if present, the Zabbix proxy.
  • Back up any custom changes made manually at the Zabbix level.

Version Check

First, we will check the versions of all components that Zabbix and its parts depend on, to make sure they match the official Zabbix 7.0 compatibility matrix exactly.

php-fpm -v
psql -V

Backing Up the Zabbix Configuration Files

Before moving on to the next steps, we will back up all the configuration files of the Zabbix server and Zabbix Proxy.

cp /etc/zabbix/zabbix_server.conf /<backup directory>/
cp /etc/zabbix/zabbix_agent2.conf /<backup directory>/
cp -R /usr/lib/zabbix/alertscripts/ /<backup directory>/
cp -R /usr/lib/zabbix/externalscripts/ /<backup directory>/
cp -R /usr/share/zabbix/ /<backup directory>/
cp /etc/httpd/conf/httpd.conf /<backup directory>/
cp /etc/httpd/conf.d/zabbix.conf /<backup directory>/
cp /etc/zabbix/web/zabbix.conf.php /<backup directory>/

Stopping the Services

First, we will stop the Zabbix server and the web server to prevent any further writes to the database.

systemctl stop zabbix-server
systemctl stop httpd

PHP Update

The new Zabbix 7.0 release requires PHP versions ranging from 8.0.0 to 8.3.x. Version 8.0 is currently available on our server, but we will perform an update anyway.

We will perform the update at the operating system level by changing the package management settings using dnf. We have had good experiences with the second-to-last release, because using the very latest version can cause a bug directly in PHP, which can lead to usage problems.

dnf module switch-to php:8.2 -y

Database Update

First, we will stop the currently running PostgreSQL service:

systemctl stop postgresql-13

Next, we will install the specifically supported version (in our case, PostgreSQL version 16):

dnf install -y postgresql16-server

Next, we will install the TimescaleDB extension, but we must install it in the same version as your old database! If it is not the same version, the upgrade command will not work. You can use the following command to compare the currently installed version for PostgreSQL 13 and install the same version of the packages for PostgreSQL 16:

VERSION=$(rpm -qa | grep timescaledb-2-postgresql-13 | head -1 | sed -n 's/.*-\([0-9]\+\.[0-9]\+\.[0-9]\+\)-.*/\1/p') && dnf install -y timescaledb-2-loader-postgresql-16-$VERSION-0.el9.x86_64 timescaledb-2-postgresql-16-$VERSION-0.el9.x86_64

Note : If the version of the TimescaleDB extension is not the same, you will see the following error during the upgrade:

We can now proceed to initialize the new version of the PostgreSQL database:

/usr/pgsql-16/bin/postgresql-16-setup initdb

After successfully installing all dependencies, we will run the provided upgrade script (as the postgres user), which will check compatibility and, if necessary, fix internal tables and schemas according to the changes between versions:

su - postgres

We will carry over the permissions configuration (pg_hba.conf) from the old version to the new one:

cat /var/lib/pgsql/13/data/pg_hba.conf > /var/lib/pgsql/16/data/pg_hba.conf

Optionally, we will also carry over the database server configuration (first make sure the individual configuration directives are compatible between versions):

cat /var/lib/pgsql/13/data/postgresql.conf > /var/lib/pgsql/16/data/postgresql.conf

We will start the database migration.

/usr/pgsql-16/bin/pg_upgrade -b /usr/pgsql-13/bin -B /usr/pgsql-16/bin -d /var/lib/pgsql/13/data -D /var/lib/pgsql/16/data -k

We will log out of the postgres user:

logout

We can now disable the automatic start of the old service:

systemctl disable postgresql-13.service

And start the new version of the PostgreSQL database server, including enabling it to start automatically at system boot:

systemctl enable postgresql-16.service --now

After successfully starting the PostgreSQL server, the first step is to check our TimescaleDB in the Zabbix database and update it if necessary:

su - postgres
psql -X
\c zabbix

In the next step, we will update the extension in the PostgreSQL database:

ALTER EXTENSION timescaledb UPDATE;

After a successful update, we will safely exit the psql console:

exit

After a successful update, we recommend performing a VACUUM and reindexing the databases. This can be done with the following commands:

/usr/pgsql-16/bin/vacuumdb --all --analyze-in-stages
reindexdb

The next step is to delete the old PostgreSQL cluster:

./delete_old_cluster.sh
rm -rf 13 delete_old_cluster.sh

We can now remove the old package versions. We will log out of the postgres user and remove the unnecessary packages. The TimescaleDB packages were replaced, so they are no longer present on the system and do not need to be removed:

logout
dnf remove postgresql13-*

In the last step, we can delete the folder containing the configuration files of the old version:

rm -rf /usr/pgsql-13/

Updating Zabbix

We have successfully backed up everything and updated all dependent component versions according to the official compatibility matrix for the new version of Zabbix.

Now we will proceed to update Zabbix itself and all its components.

First, we will download the installation packages for the new Zabbix version's repositories and clear the installation cache:

rpm -Uvh https://repo.zabbix.com/zabbix/7.0/centos/9/x86_64/zabbix-release-7.0-1.el9.noarch.rpm
dnf clean all

After this step, the repositories for the new version are available and we can update all the other Zabbix components in turn, including all Zabbix Proxies:

dnf update zabbix-* -y

Because our Zabbix database uses the TimescaleDB extension, we need to run an SQL script again to initialize the hypertables. A new feature in version 7.0 is the audit log table with a hypertable.

cat /usr/share/zabbix-sql-scripts/postgresql/timescaledb/schema.sql | sudo -u zabbix psql zabbix

After successfully completing the update of the Zabbix server packages and all components, we can restart the service:

systemctl start zabbix-server.service
systemctl start httpd

The entire update process, including the incremental operations and changes to the database schema, can be monitored in the Zabbix server log file:

tail -f /var/log/zabbix/zabbix_server.log

Note: If a database compatibility error appears after restarting the Zabbix server, simply set the following directive in the Zabbix server configuration file.

In this version of Zabbix, this is not a compatibility error; it is the TimescaleDB version number missing from the Zabbix source code itself!

Always consult the compatibility matrix in the official Zabbix documentation for the appropriate database versions and extensions for your version.

Open the Zabbix server configuration file:

nano /etc/zabbix/zabbix_server.conf

Here we will set the following parameter:

AllowUnsupportedDBVersions=1

Finally, we will restart the Zabbix server service:

systemctl restart zabbix-server.service

The Zabbix server should then begin and run the database structure upgrade:

tail -f /var/log/zabbix/zabbix_server.log

Performance Tuning After the PostgreSQL Upgrade

After successfully starting the Zabbix server, we can take an optional additional step: running the timescaledb-tune script again to fine-tune the database after the upgrade.

For this command, we will specify the path to the PostgreSQL configuration file and raise the limit on the maximum number of connections to the database, which is by default far too low for monitoring needs:

timescaledb-tune --pg-config=/usr/pgsql-16/bin/pg_config --max-conns=100

We will restart the PostgreSQL service to apply the newly set configuration parameters (ideally stop the Zabbix server during this operation, although this is not required):

systemctl restart postgresql-16.service

Final Steps

  • Verify that the Zabbix server and the database server are running correctly and have the correct version.
  • Check that all Zabbix proxies are running and have the correct version. (Backward compatibility is available from version 6.4, but we still recommend using the same version as the Zabbix server).
  • Check the status of the Zabbix server and Zabbix proxies (log files, unsupported items, queues, monitoring scripts, etc.).
  • Make sure the latest versions of the official Zabbix templates are assigned to your servers. [Zabbix GIT]

Kerim Koç

Systems and infrastructure engineer. I write about Linux, open source, high availability and security.