【问题标题】:When using Centos 6, I cannot run 'yum update' anymore, I get this error 'Cannot find a valid baseurl for repo: base'使用 Centos 6 时,我无法再运行 'yum update',我收到此错误 'Cannot find a valid baseurl for repo: base'
【发布时间】:2021-05-23 05:48:51
【问题描述】:

当使用带有 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

【问题讨论】:

    标签: yum centos6 base centos6.5 centos-6.9


    【解决方案1】:

    是的,就像 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/
    

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

    【讨论】:

      【解决方案2】:

      可能有两种可能的解决方案来解决这个问题:

      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/

      【讨论】:

      • 您能否详细说明“/scripts/autorepair centos6_base_repo_is_no_more” - 如何运行此 cmd。 (我收到未找到脚本的错误)。谢谢
      • 此脚本仅适用于来自此 repo vault.centos.org 的 Centos 6 官方镜像。如果您从另一个 repo 下载 Centos 6,则该图像可能不包含该脚本。
      • 感谢您的回复。供参考。我正在使用 Cloudera sdh 5.13 版本。 centos6.7。我已经尝试了您的第一个解决方案,但 YUM 更新失败并出现 404 发现错误。有时身份验证失败错误。如果你对此有任何想法,请在这里分享。
      • 我刚刚发布的配置应该没有问题,只需使用sudo,检查您是否有互联网连接...如果您有任何问题,请使用提供的其他两个链接。检查其他版本的 Centos 的其他类似帖子,看看他们是如何做到的,并将其与我的解决方案进行比较。可能最近修改了base url等等。冷静下来排查,应该没那么难,相信我。
      猜你喜欢
      • 1970-01-01
      • 2018-05-24
      • 1970-01-01
      • 2020-08-02
      • 2021-10-22
      • 2020-09-20
      • 1970-01-01
      • 2020-06-03
      • 1970-01-01
      相关资源
      最近更新 更多