升级至Zabbix 4.0→6.2

一. 功能概述
    • PHP 7.4.5

 

    • MySQL 8.0.X

 

    Zabbix4.47

由于CentOS 8支持已被取消,似乎需要执行以下步骤。

如果在CentOS8中执行dnf命令时出现”错误:下载repo ‘AppStream’的元数据失败:无法准备内部镜像列表:镜像列表中没有URL”的错误,请尝试以下解决方法。

执行命令:dnf check-update。

[root@zabbix ~]# dnf check-update 
CentOS-8 - AppStream 67 B/s | 38 B 00:00 
エラー: repo 'AppStream' のメタデータのダウンロードに失敗しました : Cannot prepare internal mirrorlist: No URLs in mirrorlist
[root@zabbix ~]#

请编辑位于以下目录中的 “CentOS-AppStream.repo” 文件。
将 “mirrorlist=http://mirrorlist.centos.org/~~” 注释掉,
取消注释 “baseurl=http://mirror.centos.org/~~”,
并将 “http://mirror.centos.org/” 更改为 “http://vault.centos.org/”。

vi /etc/yum.repos.d/CentOS-AppStream.repo
[AppStream]
name=CentOS-$releasever - AppStream
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
baseurl=http://vault.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

请用以下的sed命令替换位于〈/etc/yum.repos.d〉下面的内容。

执行指令 (shí

sed -i 's/mirrorlist=/#mirrorlist=/g' /etc/yum.repos.d/CentOS-* 
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

第二步:再次执行”dnf check-update”命令,确认其正常完成。

[root@zabbix ~]# dnf check-update 
CentOS-8 - AppStream                                                                              7.3 MB/s | 8.4 MB     00:01
CentOS-8 - Base                                                                                    10 MB/s | 4.6 MB     00:00
CentOS-8 - Extras                                                                                  50 kB/s |  10 kB     00:00
Extra Packages for Enterprise Linux Modular 8 - x86_64                                             35 kB/s | 9.6 kB     00:00
Extra Packages for Enterprise Linux Modular 8 - x86_64                                            961 kB/s | 733 kB     00:00
Extra Packages for Enterprise Linux 8 - x86_64                                                     12 kB/s | 9.1 kB     00:00
Extra Packages for Enterprise Linux 8 - x86_64                                                    8.3 MB/s |  13 MB     00:01
MySQL 8.0 Community Server                                                                         50 kB/s | 2.6 kB     00:00
MySQL 8.0 Community Server                                                                        7.3 MB/s | 2.7 MB     00:00
~ 長いため省略 ~
[root@zabbix ~]#
2. Zabbix升级

选项1:确认Zabbix版本
命令:zabbix_server -V

[root@zabbix yum.repos.d]# zabbix_server -V
zabbix_server (Zabbix) 4.4.7
Revision 77fb8c7ee0 23 March 2020, compilation time: Mar 23 2020 11:09:42

Copyright (C) 2020 Zabbix SIA
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it according to
the license. There is NO WARRANTY, to the extent permitted by law.

This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/).

Compiled with OpenSSL 1.1.1c FIPS  28 May 2019
Running with OpenSSL 1.1.1c FIPS  28 May 2019

第2项:PHP版本确认
命令:php -v

PHP 7.4.5 (cli) (built: Apr 14 2020 12:54:33) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.5, Copyright (c), by Zend Technologies

第3项:获取Zabbix6.2的仓库
※在获取Zabbix6.2仓库时,似乎已经删除了已下载的Zabbix4.4X。
※如果未被删除,则需要单独进行删除。
获取仓库的网站

[root@zabbix yum.repos.d]# rpm -Uvh https://repo.zabbix.com/zabbix/6.2/rhel/8/x86_64/zabbix-release-6.2-3.el8.noarch.rpm
https://repo.zabbix.com/zabbix/6.2/rhel/8/x86_64/zabbix-release-6.2-3.el8.noarch.rpm を取得中
Verifying...                          ################################# [100%]
準備しています...              ################################# [100%]
更新中 / インストール中...
   1:zabbix-release-6.2-3.el8         ################################# [ 50%]
整理中 / 削除中...
   2:zabbix-release-4.4-1.el8         ################################# [100%]

安装 Zabbix 服务器(使用MySQL)、Zabbix Web(使用MySQL)、Zabbix Apache 配置文件、Zabbix SQL 脚本、Zabbix SELinux 策略以及 Zabbix 代理。

[root@zabbix ~]# dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
CentOS-8 - AppStream                                                                               13 MB/s | 8.4 MB     00:00
CentOS-8 - Base                                                                                   6.6 MB/s | 4.6 MB     00:00
CentOS-8 - Extras                                                                                  66 kB/s |  10 kB     00:00
~ 長いため省略 ~
依存関係が解決しました。
==================================================================================================================================
 パッケージ                            アーキテクチャー       バージョン                             リポジトリー           サイズ
==================================================================================================================================
インストール:
 zabbix-agent                          x86_64                 6.0.13-release1.el8                    zabbix                 548 k
 zabbix-selinux-policy                 x86_64                 6.0.13-release1.el8                    zabbix                 293 k
 zabbix-sql-scripts                    noarch                 6.0.13-release1.el8                    zabbix                 7.3 M
アップグレード:
 zabbix-apache-conf                    noarch                 6.0.13-release1.el8                    zabbix                  24 k
 zabbix-server-mysql                   x86_64                 6.0.13-release1.el8                    zabbix                 1.6 M
 zabbix-web                            noarch                 6.0.13-release1.el8                    zabbix                 8.1 M
 zabbix-web-japanese                   noarch                 6.0.13-release1.el8                    zabbix                  24 k
 zabbix-web-mysql                      noarch                 6.0.13-release1.el8                    zabbix                  23 k
依存関係のインストール:
 zabbix-web-deps                       noarch                 6.0.13-release1.el8                    zabbix                  24 k

トランザクションの概要
==================================================================================================================================
インストール    4 パッケージ
アップグレード  5 パッケージ

ダウンロードサイズの合計: 18 M
これでよろしいですか? [y/N]: y

最后,需要启动和重新启动各种服务之后,将其设定为自动启动。

systemctl restart zabbix-server zabbix-agent httpd php-fpm
systemctl enable zabbix-server zabbix-agent httpd php-fpm
广告
将在 10 秒后关闭
bannerAds