存储库不再可用后如何从 CentOS 8 切换到 CentOS Stream

存储库不再可用后如何从 CentOS 8 切换到 CentOS Stream

回购网址消失后旧答案不再工作了:

$ 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

答案1

2022 年 5 月:以下内容对我从 CentOS 8 迁移到 CentOS Stream 8 有用:

# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
# sed -i 's/mirrorlist/#mirrorlist/g'  /etc/yum.repos.d/CentOS-*
# dnf install centos-release-stream -y --allowerasing
# dnf swap centos-{linux,stream}-repos
# dnf distro-sync --best --allowerasing
# reboot

答案2

CentOS 8 存储库仍然可用避难所这样您就可以在您的文件中使用下面的 URL .repo

您需要编辑BaseOS并注释掉该行,取消注释该行并将其替换为Extras/etc/yum.repos.d/CentOS-Linux-BaseOS.repo/etc/yum.repos.d/CentOS-Linux-Extras.repomirrorlist=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

相关内容