2 Debian/Ubuntu

Overview

This section provides the steps required for a successful upgrade from Zabbix 3.4.x to Zabbix 4.0.x using official Zabbix packages for Debian/Ubuntu.

While upgrading Zabbix agents is not mandatory (but recommended), Zabbix server and proxies must be of the same major version. Therefore, in a server-proxy setup, Zabbix server and all proxies have to be stopped and upgraded.

To minimize downtime and data loss during the upgrade, it is recommended to stop and upgrade Zabbix server and then stop, upgrade and start Zabbix proxies one after another. When all proxies are upgraded, start Zabbix server. During the Zabbix server downtime, running proxies will keep collecting and storing data and will pass the data to Zabbix server when the server is up and running. Any notifications for problems during Zabbix server downtime will be generated only after the upgraded server is started.

Note that with SQLite database on proxies, history data from proxies before the upgrade will be lost, because SQLite database upgrade is not supported and the SQLite database file has to be manually removed. When proxy is started for the first time and the SQLite database file is missing, proxy creates it automatically.

Depending on database size the database upgrade to version 4.0 may take a long time.

Before the upgrade make sure to read the relevant upgrade notes!

The following upgrade notes are available:

Upgrade from Read full upgrade notes Important notes/changes between versions
3.4.x For 4.0 'libpthread' and 'zlib' libraries now mandatory;
Support for plain text protocol dropped and header is mandatory;
Pre-1.4 version Zabbix agents are no longer supported;
The Server parameter in passive proxy configuration now mandatory
3.2.x Also for 3.4 SQLite support as backend database dropped for Zabbix server/frontend;
Perl Compatible Regular Expressions (PCRE) supported instead of POSIX extended;
'libpcre' and 'libevent' libraries mandatory for Zabbix server;
Exit code checks added for user parameters, remote commands and system.run[] items without the 'nowait' flag as well as Zabbix server executed scripts;
Zabbix Java gateway has to be upgraded to support new functionality
3.0.x Also for 3.2 Database upgrade may be slow, depending on the history table size

You may also want to check the requirements for 4.0.

It may be handy to run two parallel SSH sessions during the upgrade, executing the upgrade steps in one and monitoring the server/proxy logs in another. For example, run tail -f zabbix_server.log or tail -f zabbix_proxy.log in the second SSH session showing you the latest log file entries and possible errors in real time. This can be critical for production instances.

Upgrade procedure

1 Stop Zabbix processes

Stop Zabbix server to make sure that no new data is inserted into database.

# service zabbix-server stop

If upgrading Zabbix proxy, stop proxy too.

# service zabbix-proxy stop

It is known to be possible to upgrade the server only and have older, yet unupgraded proxies report data to a newer server (the proxies can't refresh their configuration though). This approach, however, is not recommended and not supported by Zabbix and choosing it is entirely at your own risk.

2 Back up the existing Zabbix database

This is a very important step. Make sure that you have a backup of your database. It will help if the upgrade procedure fails (lack of disk space, power off, any unexpected problem).

3 Back up configuration files, PHP files and Zabbix binaries

Make a backup copy of Zabbix binaries, configuration files and the PHP file directory.

Configuration files:

# mkdir /opt/zabbix-backup/
       # cp /etc/zabbix/zabbix_server.conf /opt/zabbix-backup/
       # cp /etc/apache2/conf-enabled/zabbix.conf /opt/zabbix-backup/

PHP files and Zabbix binaries:

# cp -R /usr/share/zabbix/ /opt/zabbix-backup/
       # cp -R /usr/share/doc/zabbix-* /opt/zabbix-backup/
4 Update repository configuration package

To proceed with the update your current repository package has to be uninstalled.

# rm -Rf /etc/apt/sources.list.d/zabbix.list

Then install the new repository configuration package.

On Debian 9 run:

# wget https://repo.zabbix.com/zabbix/4.0/debian/pool/main/z/zabbix-release/zabbix-release_4.0-2+stretch_all.deb
       # dpkg -i zabbix-release_4.0-2+stretch_all.deb

On Debian 8 run:

# wget https://repo.zabbix.com/zabbix/4.0/debian/pool/main/z/zabbix-release/zabbix-release_4.0-2+jessie_all.deb
       # dpkg -i zabbix-release_4.0-2+jessie_all.deb

On Ubuntu 18.04 run:

# wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+bionic_all.deb
       # dpkg -i zabbix-release_4.0-2+bionic_all.deb

On Ubuntu 16.04 run:

# wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+xenial_all.deb
       # dpkg -i zabbix-release_4.0-2+xenial_all.deb

On Ubuntu 14.04 run:

# wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+trusty_all.deb
       # dpkg -i zabbix-release_4.0-2+trusty_all.deb

Update the repository information.

# apt-get update
5 Upgrade Zabbix components

To upgrade Zabbix components you may run something like:

# apt-get install --only-upgrade zabbix-server-mysql zabbix-frontend-php zabbix-agent

If using PostgreSQL, substitute mysql with pgsql in the command. If upgrading the proxy, substitute server with proxy in the command.

6 Review component configuration parameters

See the upgrade notes for details on mandatory changes.

For new optional parameters, see the What's new section.

7 Start Zabbix processes

Start the updated Zabbix components.

# service zabbix-server start
       # service zabbix-proxy start
       # service zabbix-agent start
8 Clear web browser cookies and cache

After the upgrade you may need to clear web browser cookies and web browser cache for the Zabbix web interface to work properly.

Upgrade between minor versions

It is possible to upgrade minor versions of 4.0.x (for example, from 4.0.1 to 4.0.3). It is easy.

To upgrade Zabbix minor version please run:

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

To upgrade Zabbix server minor version please run:

$ sudo apt install --only-upgrade 'zabbix-server.*'

To upgrade Zabbix agent minor version please run:

$ sudo apt install --only-upgrade 'zabbix-agent.*'