how to upgrade zabbix

Upgrade Zabbix (5.0, 5.2, 5.4) to 6.0 like a Pro [+6.0 to 6.2 guide]

In this tutorial I will show you how to upgrade almost any Zabbix version (3.0, 3.2, 3.4, 4.0, 4.2, 4.4, 5.0, 5.2, 5.4) to 6.0 LTS or 6.2 Standard version using official packages from repo.zabbix.com. This is all-in-one Zabbix upgrade guide for Ubuntu, CentOS, RHEL, Oracle Linux, Debian, and Rasbian (Raspberry Pi) that takes into consideration any webserver (Apache or NGINX) and database (MySQL, MariaDB, or PostgreSQL).

Already on Zabbix 6.0? Jump to Step 10: How to upgrade Zabbix to 6.2?

Zabbix 6.0 Dashboard
Zabbix 6.0 Dashboard

Zabbix 6 brings a lot of new features, you can read about them on the official site so I won’t write about it. However, I have to mention the new changes in PHP and database requirements that should be taken into account.

Zabbix 6.0 will no longer support PHP versions older than 7.2.5. Newer operating systems support PHP 7.2.5 so you can upgrade to 6.0 without any difficulties on these Linux distributions:

  • Ubuntu 22.04 LTS (Jammy Jellyfish) / Ubuntu 20.04 (Focal)
  • CentOS 8 / RHEL 8 / Oracle Linux 8 / Alma Linux 8 / Rocky Linux 8
  • Debian 11 (Bullseye) / Debian 10 (Buster)
  • Rasberry Pi OS (Debian 11 / 10)

In addition to dropping support for older PHP versions, Zabbix 6.0 has tightened requirements for the database. Here are the minimum database versions that new Zabbix supports:

  • MySQL/Percona 8.0+
  • MariaDB 10.5+
  • PostgreSQL 13+
  • Oracle 19c+
  • TimescaleDB 2.0.1+
  • SQLite 3.3.5+

Check your database version and if it does not meet the requirements, you will first need to upgrade it before continuing with this guide or use override by setting AllowUnsupportedDBVersions=1 in Zabbix server configuration file at your own risk.

Note, this guide is for upgrading Zabbix while guides for installing Zabbix 6.0 or 6.2 from scratch on various Linux distribution can be found on these links: CentOS/AlmaLinux/RockyLinux/OracleLinux/RHELUbuntuDebianRasbian (Raspberry Pi).

Note: You need to log in as a root user on your Linux server with “su -” or use “sudo” to successfully execute commands used in this tutorial.

Step 1: Stop Zabbix Server

We must first stop the Zabbix server so that the database does not receive any data as we perform the upgrade:

systemctl stop zabbix-server

Step 2: Backup Zabbix components

Zabbix upgrade should go smoothly with no problems but there is that famous saying “better safe than sorry” or how I like to put it “better backup than spend all day in a linux terminal”.

Therefore, back up your data and copy all relevant Zabbix files to your backup directory! This will give you the option to restore the old version of Zabbix if something goes wrong with the upgrade. The procedure for restoration is described in Step 9: Restore procedure (if Zabbix upgrade fails).

a) Create directories for backup files

Create backup directories for binary, configuration, doc, web and database files.

mkdir -p /opt/zabbix_backup/bin_files /opt/zabbix_backup/conf_files /opt/zabbix_backup/doc_files
mkdir -p /opt/zabbix_backup/web_files /opt/zabbix_backup/db_files

b) Backup Zabbix binary, doc and conf files

Next, copy Zabbix binary, doc and configuration files. Some files will not exits, depending on what webserver you are using (Apache or NGINX), so I will use “2>/dev/null” to ignore copy errors.

cp -rp /etc/zabbix/zabbix_server.conf /opt/zabbix_backup/conf_files
cp -rp /usr/sbin/zabbix_server /opt/zabbix_backup/bin_files
cp -rp /usr/share/doc/zabbix-* /opt/zabbix_backup/doc_files
cp -rp /etc/httpd/conf.d/zabbix.conf /opt/zabbix_backup/conf_files 2>/dev/null
cp -rp /etc/apache2/conf-enabled/zabbix.conf /opt/zabbix_backup/conf_files 2>/dev/null
cp -rp /etc/zabbix/php-fpm.conf /opt/zabbix_backup/conf_files 2>/dev/null

c) Backup Zabbix web files (frontend)

Backup Zabbix frontend files.

cp -rp /usr/share/zabbix/ /opt/zabbix_backup/web_files

d) Backup Zabbix database

Note: This guide is tailored for Zabbix installation in combination with MySQL / MariaDB, and if you are using PostgreSQL, please google how to backup PostgreSQL!

Make sure you have enough free disk space on “/opt” or use another dictionary path for database backup.

This command will make a full backup of the Zabbix database on MySQL/MariaDB instance (change hostname, user, password and db name to match your environment):

mysqldump -h localhost -u'root' -p'rootDBpass' --single-transaction 'zabbix' | gzip > /opt/zabbix_backup/db_files/zabbix_backup.sql.gz

Note that this backup process can take anywhere from few minutes to hours, depending on the database size.

Step 3: Upgrade Zabbix Server and Frontend

Select the appropriate OS repository and upgrade the Zabbix server and frontend using the provided instructions.

Note: If using PostgreSQL, replace “mysql” with “pgsql” in the upgrade command.

a) Ubuntu 22.04 & Ubuntu 20.04

Please delete old Zabbix repository so that we can install the new one:

dpkg --purge zabbix-release

Upgrade Zabbix and when prompted what to do with Zabbix configuration file, just press enter to keep the current version of “zabbix_server.conf“:

wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-3+ubuntu$(lsb_release -rs)_all.deb
sudo dpkg -i zabbix-release_6.0-3+ubuntu$(lsb_release -rs)_all.deb
apt update
apt install -y --only-upgrade zabbix-server-mysql zabbix-frontend-php

And if you are using Apache server (httpd) install “zabbix-apache-conf“:

apt-get install -y zabbix-apache-conf

b) RHEL 8 & CentOS 8 & Oracle/Alma/Rocky Linux 8

Upgrade Zabbix and when prompted what to do with Zabbix configuration file, just press enter to keep the current version of “zabbix_server.conf

rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-2.el8.noarch.rpm
dnf clean all
dnf upgrade -y zabbix-server-mysql zabbix-web-mysql

And if you are using Apache server (httpd) install “zabbix-apache-conf“:

dnf install -y zabbix-apache-conf

c) Debian 11 & Debian 10

Please delete old Zabbix repository so that we can install the new one:

dpkg --purge zabbix-release

Upgrade Zabbix and when prompted what to do with Zabbix configuration file, just press enter to keep the current version of “zabbix_server.conf“:

wget https://repo.zabbix.com/zabbix/6.0/debian/pool/main/z/zabbix-release/zabbix-release_6.0-3+debian$(cut -d"." -f1 /etc/debian_version)_all.deb
dpkg -i zabbix-release_6.0-3+debian$(cut -d"." -f1 /etc/debian_version)_all.deb
apt update
apt install -y --only-upgrade zabbix-server-mysql zabbix-frontend-php 

And if you are using Apache server (httpd) install “zabbix-apache-conf“:

apt-get install -y zabbix-apache-conf

d) Rasbian 11 & Rasbian 10

Please delete old Zabbix repository so that we can install the new one:

dpkg --purge zabbix-release

Upgrade Zabbix and when prompted for Zabbix configuration file, just press enter to keep the current version of “zabbix_server.conf“:

wget https://repo.zabbix.com/zabbix/6.0/raspbian/pool/main/z/zabbix-release/zabbix-release_6.0-3+debian$(cut -d"." -f1 /etc/debian_version)_all.deb
dpkg -i zabbix-release_6.0-3+debian$(cut -d"." -f1 /etc/debian_version)_all.deb
apt update
apt install -y --only-upgrade zabbix-server-mysql zabbix-frontend-php 

And if you are using Apache server (httpd) install “zabbix-apache-conf“:

apt-get install -y zabbix-apache-conf

Step 4: Start Zabbix service and database upgrade

Great job! Zabbix server and frontend are successfully upgraded! However, the Zabbix database is still on the old version because we didn’t upgrade it. This is especially evident when connecting to a frontend because you would be greeted with the message “The frontend does not match Zabbix database“.

Luckily, upgrade of the Zabbix database is the easy part, just start the Zabbix service and it will automatically do the upgrade:

systemctl start zabbix-server

Database upgrade can last from 1 minute to hours depending on database size. Check the upgrade progress with the command “cat /var/log/zabbix/zabbix_server.log | grep database“:

# cat /var/log/zabbix/zabbix_server.log | grep database
1794:20200408:200607.700 current database version (mandatory/optional): 05040000/05040002
1794:20200408:200607.700 starting automatic database upgrade
1794:20200408:200607.706 completed 1% of database upgrade
1794:20200408:200608.804 completed 10% of database upgrade
                            .....
1794:20200408:200613.111 completed 98% of database upgrade
1794:20200408:200613.123 completed 100% of database upgrade
1794:20200408:200613.123 database upgrade fully completed
1794:20200408:200613.136 database could be upgraded to use primary keys in history tables

Database upgrade is completed successfully when you receive the message “database upgrade fully completed” in the Zabbix server log file.

Check out section “Learn about common upgrade errors” if you receive error “[Z3005] query failed: [1118] Row size too large“.

Step 5: Clear browser cache and check Zabbix version

Zabbix frontend may look pretty weird after the upgrade because you haven’t deleted the cache on your browser! Clear the browser cache and log in to the Zabbix.

And if you still receive the error “The frontend does not match Zabbix database” check out step 11: Learn about common upgrade errors

One more thing to do! On the server, check if the upgrade was successful with the command “zabbix_server -V“:

# zabbix_server -V
zabbix_server (Zabbix) 6.0.0

And on the frontend, check if the correct Zabbix version (6.0.x) is displayed on the bottom of the page:

Checking Zabbix version on the frontend
Checking Zabbix version on the frontend

Step 6: Database upgrade to primary keys

As of Zabbix 6.0, primary keys are used for all tables in new installations. Unfortunately there is no automation here, we have to manually upgrade the history tables in existing installations to primary keys.

Before proceeding, make sure to backup your database using Step 2!

I will run the demonstration on MariaDB 10.6, and if you are using another type of database (MySQL, PostGreSQL, TimeScaleDB, Oracle) then check out the official Zabbix guide.

a. Create new history tables and rename old ones

First, install “zabbix-sql-scripts” package:

CentOS/REHEL/Oracle Linux
dnf install -y zabbix-sql-scripts

             OR

Ubuntu/Debian/Rasperry Pi OS
apt-get install -y zabbix-sql-scripts

Then run “history_pk_prepare.sql” script to rename old history tables and create new ones with the new primary key:

 mysql -uroot -prootDBpass zabbix < /usr/share/doc/zabbix-sql-scripts/mysql/history_pk_prepare.sql

b. Migrate data from old history tables to new ones

Note that this step is optional if you do not need the old data from the history tables (you always have data from the trends tables).

Create a temporary directory to use to export and import history data (delete it after the import):

mkdir /var/lib/mysql-files && chmod 777 /var/lib/mysql-files

Connect to the MySQL/MariaDB server:

mysql -uroot -prootDBpass zabbix 

Tweak DB performance to speed up data migration and avoid timeout errors:

SET SESSION SQL_LOG_BIN=0;SET SESSION bulk_insert_buffer_size= 1024 * 1024 * 256;SET MAX_STATEMENT_TIME=0;

Migrate history data from old tables to new ones:

SELECT * INTO OUTFILE '/var/lib/mysql-files/history.csv' FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n' FROM history_old;
LOAD DATA INFILE '/var/lib/mysql-files/history.csv' IGNORE INTO TABLE history FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n';

SELECT * INTO OUTFILE '/var/lib/mysql-files/history_uint.csv' FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n' FROM history_uint_old;
LOAD DATA INFILE '/var/lib/mysql-files/history_uint.csv' IGNORE INTO TABLE history_uint FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n';

SELECT * INTO OUTFILE '/var/lib/mysql-files/history_str.csv' FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n' FROM history_str_old;
LOAD DATA INFILE '/var/lib/mysql-files/history_str.csv' IGNORE INTO TABLE history_str FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n';

SELECT * INTO OUTFILE '/var/lib/mysql-files/history_log.csv' FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n' FROM history_log_old;
LOAD DATA INFILE '/var/lib/mysql-files/history_log.csv' IGNORE INTO TABLE history_log FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n';

SELECT * INTO OUTFILE '/var/lib/mysql-files/history_text.csv' FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n' FROM history_text_old;
LOAD DATA INFILE '/var/lib/mysql-files/history_text.csv' IGNORE INTO TABLE history_text FIELDS TERMINATED BY ',' ESCAPED BY '"' LINES TERMINATED BY '\n';

If everything works correctly, then delete the old history tables from the Zabbix database:

DROP TABLE history_old;
       DROP TABLE history_uint_old;
       DROP TABLE history_str_old;
       DROP TABLE history_log_old;
       DROP TABLE history_text_old;

CONGRATULATIONS!
You have successfully upgraded Zabbix to version 6!
No need to change anything else as other steps are optional.

CONTINUE TO LEARN MORE:
How to do a minor upgrade of Zabbix (6.0.x to 6.0.y) ?
How to upgrade Zabbix-proxy or Zabbix-Agent?
Did something go wrong? Learn how to restore Zabbix to a previous version.
How to upgrade Zabbix 6.0 to 6.2 using a script?
Learn about common upgrade errors

Step 7: Upgrade between minor versions

Zabbix team works non-stop like a bee and every couple of weeks it releases a smaller upgrade that fixes bugs and brings new functionalities, so it is necessary to do the minor upgrade at least once a month. A minor upgrade is pretty safe, no need for backup, because you can easily upgrade minor versions of 6.0.x (for example, from 6.0.0 to 6.0.4) with this commands:

a) Ubuntu/Debian/Rasbian

apt install --only-upgrade 'zabbix.*'

b) CentOS / RHEL / Oracle Linux

dnf upgrade 'zabbix-*'

Restart Zabbix server afterward:

systemctl restart zabbix-server

Step 8: Upgrade Zabbix-Proxy or Zabbix-Agent

If you need to upgrade the proxy server, just repeat steps from “Step 3: Upgrade Zabbix Server, Frontend” but use “apt install -y --only-upgrade zabbix-proxy” for Ubuntu/Debian/Rasbian or “dnf upgrade -y zabbix-proxy” on RHEL (CentOS / Oracle Linux) insted of “zabbix-server-mysql zabbix-frontend-php” and restart service afterward with “systemctl restart zabbix-proxy“.

Procedure for Zabbix-Agent upgrade is similar – repeat the instruction for proxy, but replace “zabbix-proxy” with “zabbix-agent“.

Step 9: Restore procedure (if Zabbix upgrade fails)

Something went wrong? You can follow this step only if you have done everything from the Step 2: Backup Zabbix components. Make sure to change db name, db root user and db Zabbix user with yours, and if your database is on another dedicated server then change localhost also.

a) Stop Zabbix server

systemctl stop zabbix-server

b) Delete database and create a new one with the right permissions

mysql -u'root' -p'rootDBpass' -e "drop database zabbix"
mysql -u'root' -p'rootDBpass' -e "create database zabbix character set utf8 collate utf8_bin;"
mysql -u'root' -p'rootDBpass' -e "grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbixDBpass';"

c) Import database from the backup

zcat /opt/zabbix_backup/db_files/zabbix_backup.sql.gz | mysql -h localhost -u'root' -p'rootDBpass' 'zabbix'

d) Remove Zabbix web and bin files

rm -rf /usr/sbin/zabbix_server /usr/share/zabbix

e) Restore files from the backup

cp -rp /opt/zabbix_backup/conf_files/zabbix_server.conf /etc/zabbix/zabbix_server.conf
cp -rp /opt/zabbix_backup/bin_files/zabbix_server /usr/sbin/zabbix_server
cp -rp /opt/zabbix_backup/doc_files/zabbix-* /usr/share/doc/
cp -rp /opt/zabbix_backup/web_files/zabbix /usr/share/zabbix
cp -rp /opt/zabbix_backup/conf_files/zabbix.conf /etc/httpd/conf.d/zabbix.conf 2>/dev/null
cp -rp /opt/zabbix_backup/conf_files/zabbix.conf /etc/apache2/conf-enabled/zabbix.conf 2>/dev/null
cp -rp /opt/zabbix_backup/conf_files/php-fpm.conf /etc/zabbix/php-fpm.conf  2>/dev/null

f) Start Zabbix server

systemctl start zabbix-server

Delete your browser cache and you are done! Zabbix is now on an old version.

Step 10: How to upgrade Zabbix 6.0 to 6.2?

You’re probably wondering why I didn’t write about the Zabbix 6.2 upgrade instructions at the beginning of this tutorial? The answer is simple, I m not fond of the Zabbix standard release!

Zabbix 6.2 standard release brings new features but at the cost of stability (more bugs) and support is limited to only 6 months! On the other hand, the Zabbix LTS release, like 6.0, is supported for 5 years and it’s much more stable. You can find more information about Zabbix’s life cycle and release policies on the official website.

However, if you don’t care about bugs and just want to try the new features – here are the instructions just for you! Before proceeding, consider backing up your Zabbix database by following the instructions from the step 2.

a) Upgrade Zabbix to 6.2 using a bash script

Download the script “upgrade_zabbix.sh” from my site and set executable permissions:

wget http://bestmonitoringtools.com/dl/upgrade_zabbix.sh
curl http://bestmonitoringtools.com/dl/upgrade_zabbix.sh --output upgrade_zabbix.sh
chmod +x upgrade_zabbix.sh

Upgrade Zabbix 6.0 to 6.2 using the script and when prompted what to do with the Zabbix configuration file, just press enter to keep the current version of “zabbix_server.conf“.

sudo ./upgrade_zabbix.sh mysql 6.2 1

As you may have noticed, the script has 3 arguments: type of database, upgrade version, and packet version. Those arguments enable us to use the same script for various Zabbix upgrades (6.0 to 6.2 and some day 6.0 to 6.4 or 6.2 to 6.4). In the case of PostgreSQL, just replace mysql input parameter with pgsql.

b) Restart Zabbix server and upgrade the database

Upgrade of the Zabbix database is the easy part, just start the Zabbix service and it will automatically do the upgrade:

systemctl restart zabbix-server

Database upgrade can last from 1 minute to hours depending on database size. Check the upgrade progress with the command “cat /var/log/zabbix/zabbix_server.log | grep database“:

# cat /var/log/zabbix/zabbix_server.log | grep database
  1869:20220705:142803.646 current database version (mandatory/optional): 06000000/06000000
  2144:20220705:144215.172 current database version (mandatory/optional): 06000000/06000000
  2144:20220705:144215.173 starting automatic database upgrade
  2144:20220705:144215.200 completed 1% of database upgrade
  2144:20220705:144215.221 completed 2% of database upgrade
                 ....
  2144:20220705:144223.158 completed 98% of database upgrade
  2144:20220705:144223.159 completed 100% of database upgrade
  2144:20220705:144223.160 database upgrade fully completed
  13760:20220705:144235.266 current database version (mandatory/optional): 06020000/06020000

Database upgrade is completed successfully when you receive the message “database upgrade fully completed” in the Zabbix server log file.

Zabbix frontend may act weird after the upgrade if you don’t delete the cache on your browser. Clear the browser cache and log in to the Zabbix and you are done with the Zabbix upgrade!

Step 11: Learn about common upgrade errors

How to fix error “Unable to start Zabbix server due to unsupported XY database server version

Zabbix does not support some older versions of the database, you may recive a error like this:

Unable to start zabbix server due to unsupported mariadb database server version 

Don’t worry, you have two options to resolve this problem:

  • Upgrade you database
  • Ignore this error by override by setting “AllowUnsupportedDBVersions=1” in Zabbix server configuration file /etc/zabbix/zabbix_server.conf

How to fix error “[Z3005] query failed: [1118] Row size too large.

Some readers have reported upgrade failure because of the error in the log “[Z3005] query failed: [1118] Row size too large“.

[Z3005] query failed: [1118] Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs ...

If you recive error above try to disable “innodb_strict_mode“.

a) Disable innodb strict mode:

mysql -uroot -p'rootDBpass' zabbix -e "set global innodb_strict_mode='OFF';"

b) Restart Zabbix server:

systemctl restart zabbix-server 

And check if upgrade was successful with the command “cat /var/log/zabbix/zabbix_server.log | grep database“.

c) Enable innodb strick mode back:

mysql -uroot -p'rootDBpass' zabbix -e "set global innodb_strict_mode='ON';"

How to fix error “The frontend does not match Zabbix database

Error “The frontend does not match Zabbix database” can happen because of two reasons.

a) Zabbix frontend is upgraded but Zabbix database is not

This happens when you upgrade the frontend but not the Zabbix database. Error messages on frontend may look something like this:

The zabbix database version does not match current requirements. your database version: 5040000. required version: 6000000. please contact your system administrator.
The zabbix database version does not match current requirements. your database version: 5000000. required version: 6000000. please contact your system administrator.
The frontend does not match zabbix database. current database version (mandatory/optional): 5040000/5040002. required mandatory version: 6000000. contact your system administrator.
The frontend does not match Zabbix database. Current database version (mandatory/optional): 6000000/6000001. Required mandatory version: 6020000. Contact your system administrator.

First, check out Zabbix log file because database upgrade may still be in progress, in that case, you just need to wait until the upgrade is finished (do not restart Zabbix service):

# cat /var/log/zabbix/zabbix_server.log | grep database
1794:20200408:200613.123 completed 3% of database upgrade
                       ...
1794:20200408:200613.123 completed 97% of database upgrade
1794:20200408:200613.123 completed 100% of database upgrade
1794:20200408:200613.123 database upgrade fully completed
1794:20200408:200613.136 database is not upgraded to use double precision values

However, if your database is not upgrading then try to start the Zabbix service to initiate database upgrade (check the progress in the log file):

systemctl restart zabbix-server

b) Zabbix database is upgraded but Zabbix frontend is not

This happens when you upgrade the database but not the Zabbix frontend. Error messages may look something like this:

The frontend does not match Zabbix database. Current database version (mandatory/optional): 6000000/6000002. Required mandatory version: 5040000. Contact your system administrator.

Try to upgrade frontend again (Step 3), but upgrade only “zabbix-frontend-php” on Ubuntu/Debian/Rasbian or “zabbix-web-mysql” if your Zabbix is on CentOS/RHEL/Oracle Linux.

Note, if you have not used the official Zabbix package installation procedure (or my guide), then there is a chance that your frontend files are located elsewhere – in that case, you are on your own.

How to fix error “database is not upgraded to use double precision values

You may notices red “No” for “Database history tables upgraded” status on “System information” widget. What is that? If you are upgrading an older Zabbix instance, prior to 5.0 then you must apply database patch.

“Database history tables upgraded” set to “No”

With Zabbix 5.0 float data type supports precision of approximately 15 digits and bigger range. This is by default for new installations, but if you are upgrading then a manual database upgrade patch must be applied.

Before we apply the patch let’s check current table description (make sure to change db name, user and password with yours):

mysql -u'zabbix' -p'zabbixDBpass' zabbix -e "show create table history;"
| history | CREATE TABLE history (
itemid bigint(20) unsigned NOT NULL,
clock int(11) NOT NULL DEFAULT '0',
value double(16,4) NOT NULL DEFAULT '0.0000',
ns int(11) NOT NULL DEFAULT '0',
KEY history_1 (itemid,clock)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin |

Download the MySQL/MariaDB patch “double.sql” and apply it (PostGreSql users need to change “mysql” with “postgresql” in the URL path):

wget https://git.zabbix.com/projects/ZBX/repos/zabbix/raw/database/mysql/double.sql
mysql -u'zabbix' -p'zabbixDBpass' zabbix < double.sql

Check the new table description:

mysql -u'zabbix' -p'zabbixDBpass' zabbix -e "show create table history;"
history | CREATE TABLE history (
itemid bigint(20) unsigned NOT NULL,
clock int(11) NOT NULL DEFAULT '0',
value double NOT NULL DEFAULT '0',
ns int(11) NOT NULL DEFAULT '0',
KEY history_1 (itemid,clock)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin |

Now we need to add the line bellow to “zabbix.conf.php” with the text editor (“nano /etc/zabbix/web/zabbix.conf.php“) to remove warning message from the frontend:

$DB['DOUBLE_IEEE754'] = 'true';

How to fix error “cannot start HA manager: timeout while waiting for HA manager registration

This error appears on RHEL / CentOS and it is SELinux related. You need to install a new SELinux policy:

dnf -y install zabbix-selinux-policy

And enable daemons_enable_cluster_mode with this command

setsebool -P daemons_enable_cluster_mode on

Thank you for reading.

Please share your experience with the Zabbix upgrade in the comment section. What errors did you have and how did you resolve them?

45 thoughts on “Upgrade Zabbix (5.0, 5.2, 5.4) to 6.0 like a Pro [+6.0 to 6.2 guide]”

  1. Hi, first of all I wanna say thanks because I’ve followed your tutorial many times to upgrade my Zabbix versions.
    Secondly, I need some guidance now. I’ve upgraded to Zabbix 6.0 without problems in my Ubuntu 18 but I’ve tried to upgrade to Ubuntu 20 and now I’ve got the error:
    The server does not match Zabbix database. Current database version (mandatory/optional): 06000000/06000000. Required mandatory version: 04000000.
    Any tips?
    Thanks.

    1. Aldin Osmanagic

      Did you try to resolve that error using instructions from Step 10? You need to upgrade the frontend.

  2. I’d followed your instruction to install Zabbix 5.0 LTS with partitions, now I just built another test Zabbix server 5.0 with mariaDB10.3. I managed to upgrade using your tutorial to 6.0 and mariaDB10.6 but on Zabbix documentation says it uses Primary keys for history tables, I tried to follow but there is no zabbix-sql-scripts directory (I know you have it on your installing Zabbix 6.0 tutorial), is it OK to leave it like that?
    Just in case if you give direction to add the script, how about the partition?
    Thanks,

    1. Aldin Osmanagic

      I have just updated the tutorial, check out Step 6: Database upgrade to primary keys. I think partitioning should work, I’ll check that later because I’m not 100% sure

  3. First and foremost Great Tutorial!

    All going smoothly until apache upgrade:

    [email protected]:~# apt-get install -f zabbix-apache-conf
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    The following packages were automatically installed and are no longer required:
    linux-headers-4.15.0-66 linux-headers-4.15.0-66-generic
    linux-image-4.15.0-66-generic linux-modules-4.15.0-66-generic
    linux-modules-extra-4.15.0-66-generic
    Use ‘apt autoremove’ to remove them.
    The following NEW packages will be installed:
    zabbix-apache-conf
    0 upgraded, 1 newly installed, 0 to remove and 11 not upgraded.
    Need to get 0 B/5,828 B of archives.
    After this operation, 18.4 kB of additional disk space will be used.
    (Reading database … 146425 files and directories currently installed.)
    Preparing to unpack …/zabbix-apache-conf_1%3a5.0.14-1+bionic_all.deb …
    Unpacking zabbix-apache-conf (1:5.0.14-1+bionic) …
    dpkg: error processing archive /var/cache/apt/archives/zabbix-apache-conf_1%3a5.0.14-1+bionic_all.deb (–unpack):
    trying to overwrite ‘/etc/zabbix/apache.conf’, which is also in package zabbix-frontend-php 1:4.2.4-1+bionic
    Errors were encountered while processing:
    /var/cache/apt/archives/zabbix-apache-conf_1%3a5.0.14-1+bionic_all.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)

    Any ideas on how to get around this would be much appreciated.

  4. Hi
    Everything is updated but i still got that issue :
    The frontend does not match Zabbix database. Current database version (mandatory/optional): 5040000/5040000. Required mandatory version: 5000000. Contact your system administrator.

  5. Filipi Souza

    starting automatic database upgrade
    [Z3005] query failed: [1832] Cannot change column ‘scriptid’: used in a foreign key constraint ‘c_opcommand_2’ [alter table opcommand modify `scriptid` bigint unsigned not null]
    database upgrade failed

    systemctl stop zabbix_server.service
    mysql -u root
    show columns from zabbix.opcommand;
    ALTER TABLE zabbix.opcommand DROP FOREIGN KEY c_opcommand_2;
    systemctl start zabbix_server.service
    tail -f /var/log/zabbix/zabbix_server.log

Leave a Comment

Your email address will not be published.