Centos

在 repos 不再可用後如何從 CentOS 8 切換到 CentOS Stream

  • May 30, 2022

回購網址消失後,舊答案不再起作用:

$ sudo dnf install centos-release-stream
Failed to set locale, defaulting to C.UTF-8
CentOS-8 - Base                                                                                            38 kB/s | 282  B     00:00    
Errors during downloading metadata for repository 'BaseOS':
 - Status code: 404 for http://asi-fs-n.contabo.net/centos/8/BaseOS/x86_64/os/repodata/repomd.xml (IP: 79.143.183.106)
Error: Failed to download metadata for repo 'BaseOS': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

我現在如何切換?


編輯:

官方頁面的解釋,似乎也不起作用:

dnf --disablerepo '*' --enablerepo extras swap centos-linux-repos centos-stream-repos
dnf distro-sync

CentOS-8 - Base                                                                                            39 kB/s | 282  B     00:00    
Errors during downloading metadata for repository 'BaseOS':
 - Status code: 404 for http://asi-fs-n.contabo.net/centos/8/BaseOS/x86_64/os/repodata/repomd.xml (IP: 79.143.183.106)
Error: Failed to download metadata for repo 'BaseOS': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

CentOS 8 儲存庫仍可在Vault中使用,因此您可以在.repo文件中使用以下 URL。

您將需要編輯BaseOS並註釋掉該行,取消註釋該行並將其替換為Extras``/etc/yum.repos.d/CentOS-Linux-BaseOS.repo``/etc/yum.repos.d/CentOS-Linux-Extras.repo``mirrorlist=``baseurl=

baseurl=http://vault.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/

對於BaseOS回購和

baseurl=http://vault.centos.org/$contentdir/$releasever/extras/$basearch/os/

對於Extras回購。現在該dnf swap命令應該可以工作了

dnf --disablerepo '*' --enablerepo baseos,extras swap centos-linux-repos centos-stream-repos

引用自:https://unix.stackexchange.com/questions/692983