1.关闭服务器:
#service zabbix-server stop
#service apache2 stop or service httpd stop
2.备份zabbix文件
Ubuntu :
# mkdir /opt/zabbix-backup/
# cp /etc/zabbix/zabbix_server.conf /opt/zabbix-backup/
# cp /etc/apache2/conf-enabled/zabbix.conf /opt/zabbix-backup/
# cp -R /usr/share/zabbix/ /opt/zabbix-backup/
# cp -R /usr/share/doc/zabbix-* /opt/zabbix-backup/
Centos:
# mkdir /opt/zabbix-backup/
# 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/
3.替换原来的源文件
Ubuntu :
# rm -Rf /etc/apt/sources.list.d/zabbix.list
# 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
# apt-get update
添加时出现问题:dpkg: error: dpkg status database is locked by another process
#rm /var/lib/dpkg/lock
#dpkg --configure -a
Cenots:
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
4.更新zabbix程序
Ubuntu:
# apt-get install --only-upgrade zabbix-server-mysql zabbix-frontend-php zabbix-agent zabbix-proxy-mysql
出现选择时填y即可
Centos:
yum upgrade zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-proxy-mysql
5.覆盖复制文件
升级后由新的配置文件代替了原来的配置文件,zabbix使用旧配置文件也可以使用的,只是新功能配置没有情况下会变成默认状态,因此放心使用旧配置文件。
# cd /etc/zabbix/
# cp zabbix_agentd.conf.dpkg-old zabbix_agentd.conf
# cp zabbix_server.conf.dpkg-old zabbix_server.conf
# cp apache.conf.dpkg-old apache.conf
6.启动程序,等待zabbix升级数据
#service zabbix-server start
# tail -f /var/log/zabbix/zabbix_server.log
等待数据库更新
24862:20181012:173016.709 Ez Texting notifications: YES
24862:20181012:173016.709 ODBC: YES
24862:20181012:173016.709 SSH2 support: YES
24862:20181012:173016.709 IPv6 support: YES
24862:20181012:173016.709 TLS support: YES
24862:20181012:173016.709 ******************************
24862:20181012:173016.709 using configuration file: /etc/zabbix/zabbix_server.conf
24862:20181012:173016.794 current database version (mandatory/optional): 03050001/03050001
24862:20181012:173016.794 required mandatory version: 04000000
24862:20181012:173016.794 starting automatic database upgrade