About Zabbix Server
Zabbix is a free and open source network monitoring Software tool which is used to monitor and track the availability and performance of your IT infrastracture: servers, network devices and other IT assets.
In this tutorial we will cover how to upgrade Zabbix Server 3.4.x to 4.0.x on Ubuntu 16.04 LTS or Ubuntu 18.04 LTS. those steps can be used also to upgrade Zabbix Server 3.2.x to 3.4.x or to 4.0.x.
1./ Stop Zabbix Server Daemon
– Stop Zabbix Server to make sure that no new data is inserted into database:
# systemctl stop zabbix-server
2./ Back up the existing Zabbix database
– Create a directory where we will backup the Zabbix Server database and configuration Files:
# mkdir /opt/zabbix-backup/
– Use the following command to backup the Zabbix Server database, replace zabbixdb with the name of your Zabbix Server database:
# mysqldump -u root -p zabbixdb > /opt/zabbix-backup/zabbixdb.sql
Enter password:
3./ Back up configuration files, PHP files and Zabbix binaries
– To backup the Zabbix Server configuration files use the following command:
# cp /etc/zabbix/zabbix_server.conf /opt/zabbix-backup/ # cp /etc/zabbix/zabbix_agentd.conf /opt/zabbix-backup/ # cp /etc/apache2/conf-enabled/zabbix.conf /opt/zabbix-backup/
– To backup the PHP files and Zabbix Server binaries use the following command:
# cp -R /usr/share/zabbix/ /opt/zabbix-backup/ # cp -R /usr/share/doc/zabbix-* /opt/zabbix-backup/
4./ Update Zabbix Server repository configuration package
– Uninstall your current Zabbix release repository as below:
# rm -Rf /etc/apt/sources.list.d/zabbix.list
– Download the Zabbix repository package release:
# wget https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+xenial_all.deb --2018-10-07 20:49:10-- https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+xenial_all.deb Resolving repo.zabbix.com (repo.zabbix.com)... 162.243.159.138 Connecting to repo.zabbix.com (repo.zabbix.com)|162.243.159.138|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 3930 (3.8K) [application/octet-stream] Saving to: ‘zabbix-release_4.0-2+xenial_all.deb’ zabbix-release_4.0-2+xenial_all.deb 100%[==================================================================================>] 3.84K --.-KB/s in 0s 2018-10-07 20:49:11 (166 MB/s) - ‘zabbix-release_4.0-2+xenial_all.deb’ saved [3930/3930]
– Upgrade the Zabbix current repository package release as below:
# dpkg -i zabbix-release_4.0-1+xenial_all.deb dpkg: error processing archive zabbix-release_4.0-1+xenial_all.deb (--install): cannot access archive: No such file or directory Errors were encountered while processing: zabbix-release_4.0-1+xenial_all.deb root@ylplzbx01:~# dpkg -i zabbix-release_4.0-2+xenial_all.deb (Reading database ... 252597 files and directories currently installed.) Preparing to unpack zabbix-release_4.0-2+xenial_all.deb ... Unpacking zabbix-release (1:4.0-2+xenial) over (3.4-1+xenial) ... Setting up zabbix-release (1:4.0-2+xenial) ... Configuration file '/etc/apt/sources.list.d/zabbix.list' ==> Deleted (by you or by a script) since installation. ==> Package distributor has shipped an updated version. What would you like to do about it ? Your options are: Y or I : install the package maintainer's version N or O : keep your currently-installed version D : show the differences between the versions Z : start a shell to examine the situation The default action is to keep your current version. *** zabbix.list (Y/I/N/O/D/Z) [default=N] ? Y Installing new version of config file /etc/apt/sources.list.d/zabbix.list ...
– Finaly, update the repository information using the following command:
# apt-get update
5./ Upgrade Zabbix Server components
– To upgrade Zabbix Server components, run the following command:
# apt-get install --only-upgrade zabbix-server-mysql zabbix-frontend-php zabbix-agent
– After upgrading the zabbix Server components, make sure to reconfigure the Zabbix Server config file zabbix_server.conf, the apache2 configuration file zabbix.conf like before.
6./ Start Zabbix Server Daemon
# systemctl start zabbix-server
We hope this tutorial was enough helpful. If you need more information, or have any questions, just comment below and we will be glad to assist you!
13 comments
I was do this and I have problem now:
Database error
The frontend does not match Zabbix database. Current database version (mandatory/optional): 3040000/3040007. Required mandatory version: 4000000. Contact your system administrator.
Database error
The frontend does not match Zabbix database. Current database version (mandatory/optional): 3040000/3040007. Required mandatory version: 4000000. Contact your system administrator.
Hi,
As indicated before starting the zabbix server, you need to reconfigure your zabbix configuration file zabbix_server.conf and zabbix.conf as were in before .
Thx for quick answer! Reconfigure ? Not copy from bacup file /opt/zabbix-backup/?
It’s better to reconfigure, they should be the Zabbix database name, zabbix user and the Password for the connection to the datbase, for the apache2 file zabbix.conf i guess you need to change the time zone. It depends all from your old configuration, you can use the diff command to compare between files in the case if you don’t remember the configuration.
Waiting for you feedback .
Hi, I have a another problem:
2788:20181127:112423.083 Starting Zabbix Server. Zabbix 4.0.1 (revision 86073).
2788:20181127:112423.084 ****** Enabled features ******
2788:20181127:112423.084 SNMP monitoring: YES
2788:20181127:112423.084 IPMI monitoring: YES
2788:20181127:112423.084 Web monitoring: YES
2788:20181127:112423.084 VMware monitoring: YES
2788:20181127:112423.084 SMTP authentication: YES
2788:20181127:112423.084 Jabber notifications: YES
2788:20181127:112423.084 Ez Texting notifications: YES
2788:20181127:112423.084 ODBC: YES
2788:20181127:112423.084 SSH2 support: YES
2788:20181127:112423.084 IPv6 support: YES
2788:20181127:112423.084 TLS support: YES
2788:20181127:112423.084 ******************************
2788:20181127:112423.084 using configuration file: /etc/zabbix/zabbix_server.conf
2788:20181127:112423.088 current database version (mandatory/optional): 03050047/03050047
2788:20181127:112423.088 required mandatory version: 04000000
2788:20181127:112423.088 starting automatic database upgrade
2788:20181127:112423.089 [Z3005] query failed: [1060] Duplicate column name ‘query_fields’ [alter table `items` add `query_fields` varchar(2048) default ” not null]
2788:20181127:112423.089 database upgrade failed
Do You know what Can i Do wtih tihs?
Hi,
From which version are you upgrading? Did you reconfigured the zabbix_server with the zabbix DBHost and DBname and dbuser?
check the size of the tmp directory of the mysql/Mariadb. I guess it fails because ther’s no enough space to upgrade.
Hi, i upgrading zabbix from version 3.4.15 to 4.0.2.
Yes i reconfigured the zabbix server.conf DBHost etc.
Problem have been resolved
i conneted to my mysql and query this comand:
alter table items drop column query_fields;
Thanks for all!
Hi, glad that you fixed just by droping the column “query_fields”.
Cheers mate, good article very helpfull.
Thanks, we are glad that our tutorials guide are useful. Subscribe.
Hello,
Please, can you help wit this error message. I tried to install zabbix 3.4 Everything went successful till when I login to the broswer.
I got the error below:
——————————————————————————–
Cannot connect to the database.
Details
The frontend does not match Zabbix database.
———————————————————————
I created the database manually but the error is still the same as above.
Thank you.
Hi,
After upgrading the zabbix Server components, make sure to reconfigure the Zabbix Server config file zabbix_server.conf and the apache2 configuration file zabbix.conf like before
Am installed zabbix 4 and trying to access the console getting below error. please help me here
The frontend does not match Zabbix database. Current database version (mandatory/optional): 0/0. Required mandatory version: 4000000. Contact your system administrator.