如何解决使用 Centos 6 时,我无法再运行“yum update”,出现此错误“无法为 repo 找到有效的 baseurl:base”
当 VirtualBox 与 Centos6 映像一起使用时,我无法再执行 yum udpate,我在互联网上查看过,看起来 Centos6 已被弃用。
[root@centos69 ~]# yum makecache
Failed to set locale,defaulting to C
Loaded plugins: fastestmirror,refresh-packagekit,security
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp,http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
[root@centos69 ~]# yum update
Failed to set locale,security
Setting up Update Process
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp,http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
解决方法
可能有两种可能的解决方案来解决这个问题:
- 使用 vim 编辑 CentOS-Base.repo 文件
vim /etc/yum.repos.d/CentOS-Base.repo
删除或注释以“mirrorlist”开头的每一行。
并将以下行添加到文件的每个 [section] 中,例如 [base]、[updates]...
baseurl=https://vault.centos.org/6.10/os/$basearch/
- 另一种解决方案可能是在来自此存储库的图像上运行此命令 https://vault.centos.org/
/scripts/autorepair centos6_base_repo_is_no_more
有关这些解决方案的更多信息:
https://support.cpanel.net/hc/en-us/articles/360058490254--CentOS-6-End-of-Life-Notice
https://forums.cpanel.net/threads/yumrepo-error-and-cannot-find-valid-baseurl.682465/
,是的,就像 red hat 6.x centos 6 确实在 2020 年 11 月停产一样,希望您在那个虚拟机中没有任何敏感内容。 https://forums.centos.org/viewtopic.php?t=72710
您可以更改为使用 vault.centos.org 上的保管库。首先,您应该禁用任何不再有效的存储库。您可以使用
获取存储库列表yum repolist
然后你可以用
禁用它们yum-config-manager --disable {reponame} {reponame}
喜欢
yum-config-manager --disable base update
或者只是禁用所有这些
yum-config-manager |grep ^\\[|tr -d ']['|xargs yum-config-manager --disable
一旦损坏的存储库被禁用,您需要添加保管库存储库。
yum-config-manager --add-repo=https://vault.centos.org/6.10/os/x86_64/
之后您可以根据需要安装软件包,但请记住 - 它不会对任何内容进行更新,因此如果担心安全问题,您需要将操作系统更改为受支持的更新版本。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。