Upgrade Zabbix Server to 5.0 LTS

Earlier this month, Zabbix server 5.0 LTS was released. Version 5.0 brings an updated UI, additional cloud integrations and support for the latest Zabbix agent (the old agent is still supported so you don’t need to upgrade the agent on all your hosts immediately). If you are using Zabbix Proxy to monitor some of your hosts, you will need to update this at the same time as the proxy and server must have the same major version number as the server.

I will be upgrading the Zabbix server I set up in my previous tutorials on Zabbix so this guide assumes a CentOS 8 operating system. With the exception of the package manager commands, the steps should be more or less the same on any Linux distribution.

Update your system

Before making major changes it is worth making sure the base system is up to date to make sure there aren’t any issues arising from using older packages. Run the following commands to update and reboot the system.

dnf upgrade

Back up your current installation

While the upgrade process shouldn’t cause too many problems, it will make changes to your database and overwrite the old installation. In the event that this process runs into an error or the machine crashes or loses power while the upgrade is in progress, having a backup of your database and configuration files will make recovery a lot easier.

Create a directory to store all your backups:

mkdir /opt/zabbix-backup
cd /opt/zabbix-backup

Now we will need to stop the Zabbix server to ensure that the database remains in a consistent state while we are performing the backups. Run the following commands to stop Zabbix and write the database to a file:

systemctl stop zabbix-server.service
mysqldump -u[zabbix-user] -p [zabbix database] > zabbix-database.sql

For the mysqldump command, you will need to enter the names of the Zabbix database user and the database in the appropriate places. If you do not remember what these are, check in /etc/zabbix/zabbix_server.conf. The lines you are looking for are DBName, DBUser and DBPassword.

You will also want to back up your configuration files as follows:

cp /etc/zabbix/zabbix_server.conf /opt/zabbix-backup/
cp /etc/httpd/conf.d/zabbix.conf  /opt/zabbix-backup/
cp -R /usr/share/zabbix/ /opt/zabbix-backup/
cp -R /usr/share/doc/zabbix-* /opt/zabbix-backup/

Update Zabbix

Install the new repo by running the following commands:

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

If you are not running CentOS 8, check the Zabbix download page for the link the the correct repo for your distribution and the required commands to install it.

This will remove the old 4.0 repo from your system and replace it with the 5.0 repo. Now you can just upgrade your Zabbix packages as follows:

yum upgrade zabbix*

If the update installs without errors, restart the Zabbix server and agent as follows:

systemctl restart zabbix-server.service
systemctl restart zabbix-agent.service

Copy the Apache config file back to its original location and restart Apache:

cp /opt/zabbix-backup/zabbix.conf /etc/httpd/conf.d/
systemctl restart httpd

You should now be able to log in to the Zabbix web console. You’ll see that the UI now has the navigation menus on the left hand side and the version number at the bottom has changed to 5.0.1. If the page doesn’t load correctly, clear your browser cache and cookies and try again.

Screenshot of Zabbix 5.0.1 dashboard