[关闭]
@llplmlyd 2022-04-29T16:27:57.000000Z 字数 2392 阅读 480

YUM :Cannot find a valid baseurl for repo(更换yum源)

工具类


本来想尝试使用清华源 但是centos6失败了,更换源之后还是报错找不到对应的这个repomd xml文件。主要是源的选择问题。
https://mirrors.tuna.tsinghua.edu.cn/centos-vault//os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"

本文修改的系统的Centos6.10,由于centos6在2020年12月已宣布不再维护,国内源基本无法使用,只能使用国外源了。
具体可参考blog说法 CentOS 6配置国内Yum源报错失效,需配置国外Yum源

1.备份yum源

  1. [root@lori ~]# cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

2.修改yum源,找到文件中的baseurl字段,将其前面的注释清掉;在mirrorlist前增加注释
然后在base/update/extras中各自添加一栏baseurl,如下

  1. basebaseurl=https://vault.centos.org/6.10/os/$basearch/
  2. updatebaseurl=https://vault.centos.org/6.10/updates/$basearch/
  3. extrasbaseurl=https://vault.centos.org/6.10/extras/$basearch/
  1. [base]
  2. name=CentOS-$releasever - Base
  3. mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
  4. #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
  5. gpgcheck=1
  6. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
  7. #released updates
  8. [updates]
  9. name=CentOS-$releasever - Updates
  10. mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
  11. #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
  12. gpgcheck=1
  13. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
  14. #additional packages that may be useful
  15. [extras]
  16. name=CentOS-$releasever - Extras
  17. mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
  18. #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
  1. [base]
  2. name=CentOS-$releasever - Base
  3. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
  4. baseurl=https://vault.centos.org/6.10/os/$basearch/
  5. gpgcheck=1
  6. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
  7. #released updates
  8. [updates]
  9. name=CentOS-$releasever - Updates
  10. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
  11. baseurl=https://vault.centos.org/6.10/updates/$basearch/
  12. gpgcheck=1
  13. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
  14. #additional packages that may be useful
  15. [extras]
  16. name=CentOS-$releasever - Extras
  17. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
  18. baseurl=https://vault.centos.org/6.10/extras/$basearch/
  19. gpgcheck=1
  20. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

3.清除缓存,更新缓存

  1. yum clean all
  2. mv /var/cache/yum /var/cache/yum_bak
  3. yum makecache
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注