0

当使用带有 Centos6 映像的 VirtualBox 时,我无法再进行 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, defaulting to C
Loaded plugins: fastestmirror, refresh-packagekit, 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
4

2 回答 2

3

解决此问题可能有两种可能的解决方案:

  1. 用 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/
  1. 另一种解决方案可能是在来自此 repo 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/

于 2021-02-20T11:39:52.960 回答
2

是的,就像 red hat 6.x centos 6 确实在 2020 年 11 月 EOL 一样,希望你在那个 vm 中没有任何敏感的东西。 https://forums.centos.org/viewtopic.php?t=72710

您可以在 vault.centos.org 更改以使用保险库。首先,您应该禁用任何不再工作的 repo。您可以通过以下方式获取存储库列表

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/

之后,您可以根据需要安装软件包,但请记住 - 它不会对任何内容进行更新,因此如果担心安全性,您需要将 os 更改为受支持的更新版本。

于 2021-02-20T17:15:38.557 回答