@llplmlyd
2022-04-29T16:27:57.000000Z
字数 2392
阅读 480
工具类
本来想尝试使用清华源 但是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源
[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,如下
base:baseurl=https://vault.centos.org/6.10/os/$basearch/
update:baseurl=https://vault.centos.org/6.10/updates/$basearch/
extras:baseurl=https://vault.centos.org/6.10/extras/$basearch/
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=https://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=https://vault.centos.org/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=https://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
3.清除缓存,更新缓存
yum clean all
mv /var/cache/yum /var/cache/yum_bak
yum makecache