測試環境為 CentOS 7/8 x86_64 (虛擬機)
目前正在使用的 CentOS Linux 7 end of life 為 June 30 2024 , CentOS Linux 8 End Of Life (EOL) 為 December 31st, 2021,想要繼續更新 CentOS 方式有 2 種.
[root@localhost ~]# yum update CentOS-8 - AppStream 70 B/s | 38 B 00:00 Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
CentOS repo
主要是修改 Repo 的地方到 vault.centos.org
[root@localhost ~]# cd /etc/yum.repos.d/ [root@localhost yum.repos.d]# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* [root@localhost yum.repos.d]# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
這樣就可以繼續更新了,但這個也沒再更新了,只是不會出現錯誤,建議使用下面方式改成 CentOS Stream 版本.
[root@localhost yum.repos.d]# yum update -y
CentOS Stream
原先 CentOS 是 RHEL 釋出後的開源版本
Fedora -> RHEL -> CentOS
但如今規則改變了 CentOS Stream 成為 RHEL 釋出前的開源版本.
Fedora -> CentOS Stream -> RHEL
[root@localhost ~]# dnf install centos-release-stream -y --allowerasing [root@localhost ~]# dnf distro-sync -y
或是
[root@localhost ~]# dnf --disablerepo '*' --enablerepo extras swap centos-linux-repos centos-stream-repos [root@localhost ~]# dnf distro-sync -y
已經變成 CentOS Stream 版本了.
[root@localhost ~]# more /etc/redhat-release CentOS Stream release 8
遇到的錯誤
[root@localhost ~]# cd /etc/yum.repos.d/ [root@localhost yum.repos.d]# dnf distro-sync -y CentOS-Stream - AppStream 807 kB/s | 22 MB 00:27 CentOS-Stream - Base 514 kB/s | 22 MB 00:43 CentOS-Stream - Extras 9.8 kB/s | 18 kB 00:01 Last metadata expiration check: 0:00:01 ago on Wed 11 May 2022 07:30:59 PM PDT. Error: Problem 1: package centos-linux-repos-8-3.el8.noarch requires centos-gpg-keys = 1:8-3.el8, but none of the providers can be installed - cannot install both centos-gpg-keys-1:8-6.el8.noarch and centos-gpg-keys-1:8-3.el8.noarch - cannot install the best update candidate for package centos-linux-repos-8-3.el8.noarch - cannot install the best update candidate for package centos-gpg-keys-1:8-3.el8.noarch Problem 2: problem with installed package centos-linux-repos-8-3.el8.noarch - package centos-linux-repos-8-3.el8.noarch conflicts with centos-repos(8) provided by centos-stream-repos-8-2.el8.noarch - package centos-stream-repos-8-2.el8.noarch conflicts with centos-repos(8) provided by centos-linux-repos-8-3.el8.noarch - package centos-stream-release-8.6-1.el8.noarch requires centos-stream-repos, but none of the providers can be installed - package centos-linux-repos-8-3.el8.noarch conflicts with centos-repos(8) provided by centos-stream-repos-8-3.el8.noarch - package centos-stream-repos-8-3.el8.noarch conflicts with centos-repos(8) provided by centos-linux-repos-8-3.el8.noarch - package centos-stream-repos-8-4.el8.noarch requires centos-gpg-keys = 1:8-4.el8, but none of the providers can be installed - package centos-linux-repos-8-3.el8.noarch requires centos-gpg-keys = 1:8-3.el8, but none of the providers can be installed - cannot install both centos-gpg-keys-1:8-4.el8.noarch and centos-gpg-keys-1:8-3.el8.noarch - package centos-stream-repos-8-6.el8.noarch requires centos-gpg-keys = 1:8-6.el8, but none of the providers can be installed - cannot install both centos-gpg-keys-1:8-6.el8.noarch and centos-gpg-keys-1:8-3.el8.noarch - cannot install the best update candidate for package centos-linux-release-8.5-1.2111.el8.noarch (try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages) [root@localhost yum.repos.d]# yum update -y Last metadata expiration check: 0:00:16 ago on Wed 11 May 2022 07:30:59 PM PDT. Error: Problem 1: package centos-linux-repos-8-3.el8.noarch requires centos-gpg-keys = 1:8-3.el8, but none of the providers can be installed - cannot install both centos-gpg-keys-1:8-6.el8.noarch and centos-gpg-keys-1:8-3.el8.noarch - cannot install the best update candidate for package centos-linux-repos-8-3.el8.noarch - cannot install the best update candidate for package centos-gpg-keys-1:8-3.el8.noarch Problem 2: problem with installed package centos-linux-repos-8-3.el8.noarch - package centos-linux-repos-8-3.el8.noarch conflicts with centos-repos(8) provided by centos-stream-repos-8-2.el8.noarch - package centos-stream-repos-8-2.el8.noarch conflicts with centos-repos(8) provided by centos-linux-repos-8-3.el8.noarch - package centos-stream-release-8.6-1.el8.noarch requires centos-stream-repos, but none of the providers can be installed - package centos-linux-repos-8-3.el8.noarch conflicts with centos-repos(8) provided by centos-stream-repos-8-3.el8.noarch - package centos-stream-repos-8-3.el8.noarch conflicts with centos-repos(8) provided by centos-linux-repos-8-3.el8.noarch - package centos-stream-repos-8-4.el8.noarch requires centos-gpg-keys = 1:8-4.el8, but none of the providers can be installed - package centos-linux-repos-8-3.el8.noarch requires centos-gpg-keys = 1:8-3.el8, but none of the providers can be installed - cannot install both centos-gpg-keys-1:8-4.el8.noarch and centos-gpg-keys-1:8-3.el8.noarch - package centos-stream-repos-8-6.el8.noarch requires centos-gpg-keys = 1:8-6.el8, but none of the providers can be installed - cannot install both centos-gpg-keys-1:8-6.el8.noarch and centos-gpg-keys-1:8-3.el8.noarch - cannot install the best update candidate for package centos-linux-release-8.5-1.2111.el8.noarch (try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages) [root@localhost yum.repos.d]# ll total 88 -rw-r--r-- 1 root root 721 May 11 19:13 CentOS-Linux-AppStream.repo -rw-r--r-- 1 root root 706 May 11 19:13 CentOS-Linux-BaseOS.repo -rw-r--r-- 1 root root 1132 May 11 19:13 CentOS-Linux-ContinuousRelease.repo -rw-r--r-- 1 root root 318 May 11 19:13 CentOS-Linux-Debuginfo.repo -rw-r--r-- 1 root root 734 May 11 19:13 CentOS-Linux-Devel.repo -rw-r--r-- 1 root root 706 May 11 19:13 CentOS-Linux-Extras.repo -rw-r--r-- 1 root root 721 May 11 19:13 CentOS-Linux-FastTrack.repo -rw-r--r-- 1 root root 742 May 11 19:13 CentOS-Linux-HighAvailability.repo -rw-r--r-- 1 root root 693 May 11 19:13 CentOS-Linux-Media.repo -rw-r--r-- 1 root root 708 May 11 19:13 CentOS-Linux-Plus.repo -rw-r--r-- 1 root root 726 May 11 19:13 CentOS-Linux-PowerTools.repo -rw-r--r-- 1 root root 1124 May 11 19:13 CentOS-Linux-Sources.repo -rw-r--r-- 1 root root 725 Dec 19 2019 CentOS-Stream-AppStream.repo -rw-r--r-- 1 root root 706 Dec 19 2019 CentOS-Stream-Base.repo -rw-r--r-- 1 root root 796 Dec 19 2019 CentOS-Stream-centosplus.repo -rw-r--r-- 1 root root 666 Dec 19 2019 CentOS-Stream-Debuginfo.repo -rw-r--r-- 1 root root 750 Dec 19 2019 CentOS-Stream-Extras.repo -rw-r--r-- 1 root root 932 Dec 19 2019 CentOS-Stream-Media.repo -rw-r--r-- 1 root root 730 Dec 19 2019 CentOS-Stream-PowerTools.repo -rw-r--r-- 1 root root 1374 Dec 19 2019 CentOS-Stream-Sources.repo -rw-r--r-- 1 root root 74 Dec 19 2019 CentOS-Stream-Vault.repo -rw-r--r-- 1 root root 358 May 11 19:29 redhat.repo
把非 CentOS-Stream 搬移.
[root@localhost yum.repos.d]# mkdir centos [root@localhost yum.repos.d]# mv CentOS-Linux-* centos/ [root@localhost yum.repos.d]# ll total 44 drwxr-xr-x 2 root root 4096 May 11 19:34 centos -rw-r--r-- 1 root root 725 Dec 19 2019 CentOS-Stream-AppStream.repo -rw-r--r-- 1 root root 706 Dec 19 2019 CentOS-Stream-Base.repo -rw-r--r-- 1 root root 796 Dec 19 2019 CentOS-Stream-centosplus.repo -rw-r--r-- 1 root root 666 Dec 19 2019 CentOS-Stream-Debuginfo.repo -rw-r--r-- 1 root root 750 Dec 19 2019 CentOS-Stream-Extras.repo -rw-r--r-- 1 root root 932 Dec 19 2019 CentOS-Stream-Media.repo -rw-r--r-- 1 root root 730 Dec 19 2019 CentOS-Stream-PowerTools.repo -rw-r--r-- 1 root root 1374 Dec 19 2019 CentOS-Stream-Sources.repo -rw-r--r-- 1 root root 74 Dec 19 2019 CentOS-Stream-Vault.repo -rw-r--r-- 1 root root 358 May 11 19:29 redhat.repo [root@localhost yum.repos.d]# dnf install centos-release-stream -y --allowerasing Last metadata expiration check: 0:03:25 ago on Wed 11 May 2022 07:30:59 PM PDT. Package centos-release-stream-8.1-1.1911.0.7.el8.x86_64 is already installed. Dependencies resolved. ======================================================================================================================== Package Architecture Version Repository Size ======================================================================================================================== Installing: centos-stream-release noarch 8.6-1.el8 Stream-BaseOS 22 k replacing centos-linux-release.noarch 8.5-1.2111.el8 replacing centos-release-stream.x86_64 8.1-1.1911.0.7.el8 Installing dependencies: centos-stream-repos noarch 8-3.el8 Stream-BaseOS 19 k Removing dependent packages: centos-linux-repos noarch 8-3.el8 @baseos 26 k Transaction Summary ======================================================================================================================== Install 2 Packages Remove 1 Package Total download size: 42 k Downloading Packages: (1/2): centos-stream-repos-8-3.el8.noarch.rpm 52 kB/s | 19 kB 00:00 (2/2): centos-stream-release-8.6-1.el8.noarch.rpm 59 kB/s | 22 kB 00:00 ------------------------------------------------------------------------------------------------------------------------ Total 47 kB/s | 42 kB 00:00 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: centos-stream-repos-8-3.el8.noarch 1/1 Installing : centos-stream-repos-8-3.el8.noarch 1/5 Installing : centos-stream-release-8.6-1.el8.noarch 2/5 Obsoleting : centos-release-stream-8.1-1.1911.0.7.el8.x86_64 3/5 Obsoleting : centos-linux-release-8.5-1.2111.el8.noarch 4/5 Erasing : centos-linux-repos-8-3.el8.noarch 5/5 warning: file /etc/yum.repos.d/CentOS-Linux-Sources.repo: remove failed: No such file or directory warning: file /etc/yum.repos.d/CentOS-Linux-PowerTools.repo: remove failed: No such file or directory warning: file /etc/yum.repos.d/CentOS-Linux-Plus.repo: remove failed: No such file or directory warning: file /etc/yum.repos.d/CentOS-Linux-Media.repo: remove failed: No such file or directory warning: file /etc/yum.repos.d/CentOS-Linux-HighAvailability.repo: remove failed: No such file or directory warning: file /etc/yum.repos.d/CentOS-Linux-FastTrack.repo: remove failed: No such file or directory warning: file /etc/yum.repos.d/CentOS-Linux-Extras.repo: remove failed: No such file or directory warning: file /etc/yum.repos.d/CentOS-Linux-Devel.repo: remove failed: No such file or directory warning: file /etc/yum.repos.d/CentOS-Linux-Debuginfo.repo: remove failed: No such file or directory warning: file /etc/yum.repos.d/CentOS-Linux-ContinuousRelease.repo: remove failed: No such file or directory warning: file /etc/yum.repos.d/CentOS-Linux-BaseOS.repo: remove failed: No such file or directory warning: file /etc/yum.repos.d/CentOS-Linux-AppStream.repo: remove failed: No such file or directory Running scriptlet: centos-linux-repos-8-3.el8.noarch 5/5 Verifying : centos-stream-release-8.6-1.el8.noarch 1/5 Verifying : centos-linux-release-8.5-1.2111.el8.noarch 2/5 Verifying : centos-release-stream-8.1-1.1911.0.7.el8.x86_64 3/5 Verifying : centos-stream-repos-8-3.el8.noarch 4/5 Verifying : centos-linux-repos-8-3.el8.noarch 5/5 Installed products updated. Installed: centos-stream-release-8.6-1.el8.noarch centos-stream-repos-8-3.el8.noarch Removed: centos-linux-repos-8-3.el8.noarch Complete! [root@localhost yum.repos.d]# more /etc/redhat-release CentOS Stream release 8
就可以更新了.
[root@localhost yum.repos.d]# dnf distro-sync -y
沒有解決問題,試試搜尋本站其他內容