1.zabbix备份 mkdir -p /soft/zabbixback/zabbix-backup cp /etc/zabbix/zabbix_server.conf /soft/zabbixback/zabbix-backup cp /etc/zabbix/zabbix_agentd.conf /soft/zabbixback/zabbix-backup cp /etc/zabbix/web/zabbix.conf.php /soft/zabbixback/zabbix-backup cp -R /usr/share/zabbix/ /soft/zabbixback/zabbix-backup cp -R /usr/share/doc/zabbix-* /soft/zabbixback/zabbix-backup
[root@server201-zabbix ~]# ll /soft/zabbixback/zabbix-backup total 44 drwxr-xr-x 10 root root 4096 Sep 15 11:38 zabbix drwxr-xr-x 2 root root 111 Sep 15 11:38 zabbix-agent-4.4.10 -rw-r--r-- 1 root root 13934 Sep 15 11:37 zabbix_agentd.conf -rw-r--r-- 1 root root 420 Sep 15 11:37 zabbix.conf.php drwxr-xr-x 2 root root 79 Sep 15 11:38 zabbix-get-4.2.8 drwxr-xr-x 2 root root 17 Sep 15 11:38 zabbix-release-4.4 -rw-r----- 1 root root 17572 Sep 15 11:37 zabbix_server.conf drwxr-xr-x 2 root root 100 Sep 15 11:38 zabbix-server-mysql-4.2.8 drwxr-xr-x 2 root root 79 Sep 15 11:38 zabbix-web-4.2.8 2.mysql数据库备份

mkdir -p /home/backup/ mysqldump -uzabbix -p111111 --opt --skip-lock-tables zabbix | gzip > /home/backup/zabbix_$(date +%Y%m%d_%H%M%S).sql.gz [root@server201-zabbix ~]# ll /home/backup/ total 1912 -rw-r--r-- 1 root root 1954490 Sep 15 11:42 zabbix_20200915_114236.sql.gz 停止 zabbix-server,zabbix-agent systemctl stop zabbix-agent zabbix-server 4.卸载旧版本4.2 yum remove zabbix-web-* httpd -y 4.2升级5.0

[root@server201-zabbix ~]# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm Retrieving https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm Preparing… ################################# [100%] Updating / installing… 1:zabbix-release-5.0-1.el7 ################################# [ 50%] Cleaning up / removing… 2:zabbix-release-4.4-1.el7 ################################# [100%] [root@server201-zabbix ~]# yum clean all Loaded plugins: fastestmirror, langpacks Cleaning repos: base docker-ce-stable extras updates zabbix zabbix-non-supported Cleaning up list of fastest mirrors Other repos take up 2.8 M of disk space (use —verbose for details) [root@server201-zabbix ~]# yum update zabbix-server zabbix-agent -y

[root@server201-zabbix ~]# yum-config-manager —enable rhel-server-rhscl-7-rpms

  1. 编辑zabbix.repo文件 [root@server201-zabbix ~]# vim /etc/yum.repos.d/zabbix.repo [zabbix] name=Zabbix Official Repository - $basearch baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-frontend] name=Zabbix Official Repository frontend - $basearch baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/frontend enabled=1 #0改为1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-debuginfo] name=Zabbix Official Repository debuginfo - $basearch baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/debuginfo/ enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 gpgcheck=1 [zabbix-non-supported] name=Zabbix Official Repository non-supported - $basearch baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/ enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX gpgcheck=1
  2. 安装zabbix前端包

[root@server201-zabbix ~]# yum install zabbix-web-mysql-scl zabbix-apache-conf-scl centos-release-scl -y ---> Package zabbix-web-mysql-scl.noarch 0:5.0.3-1.el7 will be installed --> Processing Dependency: rh-php72-php-mysqlnd for package: zabbix-web-mysql-scl-5.0.3-1.el7.noarch --> Finished Dependency Resolution Error: Package: zabbix-web-deps-scl-5.0.3-1.el7.noarch (zabbix-frontend) Requires: rh-php72-php-mbstring Error: Package: zabbix-web-deps-scl-5.0.3-1.el7.noarch (zabbix-frontend) Requires: rh-php72-php-bcmath Error: Package: zabbix-web-deps-scl-5.0.3-1.el7.noarch (zabbix-frontend) Requires: rh-php72-php-gd Error: Package: zabbix-web-mysql-scl-5.0.3-1.el7.noarch (zabbix-frontend) Requires: rh-php72-php-mysqlnd Error: Package: zabbix-web-deps-scl-5.0.3-1.el7.noarch (zabbix-frontend) Requires: rh-php72-php-xml Error: Package: zabbix-web-deps-scl-5.0.3-1.el7.noarch (zabbix-frontend) Requires: rh-php72-php-ldap Error: Package: zabbix-web-deps-scl-5.0.3-1.el7.noarch (zabbix-frontend) Requires: rh-php72-php-fpm Error: Package: zabbix-web-deps-scl-5.0.3-1.el7.noarch (zabbix-frontend) Requires: rh-php72 You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest 缺少依赖包需安装以下包 [root@server201-zabbix ~]# yum install centos-release-scl [root@server201-zabbix ~]# yum install zabbix-web-mysql-scl zabbix-apache-conf-scl centos-release-scl -y

Zabbix前端PHP配置

10.9.启动Zabbix server和agent进程 启动Zabbix server和agent进程,并为它们设置开机自启:

[root@server201-zabbix ~]# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm [root@server201-zabbix ~]# systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm 10.查看zabbix版本

[root@server201-zabbix ~]# rpm -qa |grep zabbix zabbix-release-5.0-1.el7.noarch zabbix-web-5.0.3-1.el7.noarch zabbix-server-mysql-5.0.3-1.el7.x86_64 zabbix-web-mysql-scl-5.0.3-1.el7.noarch zabbix-apache-conf-scl-5.0.3-1.el7.noarch zabbix-get-5.0.3-1.el7.x86_64 zabbix-agent-5.0.3-1.el7.x86_64 zabbix-web-deps-scl-5.0.3-1.el7.noarch

11.zabbix-agent端升级

[root@jenkins ~]# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm [root@jenkins ~]# systemctl restart zabbix-agent users:(("sshd",pid=1018,fd=4)) [root@jenkins ~]# rpm -qa |grep abbix zabbix-release-5.0-1.el7.noarch zabbix-agent-5.0.3-1.el7.x86_64