解决redhat(centos)中yum源报错failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.

解决在redhat中更换centos源报错的问题!

failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.
https://mirrors.ustc.edu.cn/centos/$releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
 

跟换了各种yum源,百度加谷歌了N篇文章得不到解决,索性认真看了一下报错如下:

https://mirrors.ustc.edu.cn/centos/$releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found

提示https://mirrors.ustc.edu.cn/centos/$releasever/os/x86_64/repodata/repomd.xml这个baseurl基地址返回404错误,显然这根本不是一个有效的地址。其有效地址应该为:https://mirrors.ustc.edu.cn/centos/7/os/x86_64/repodata/repomd.xml

在redhat7中查看 $releasever变量似乎根本不存在

[root@qsing_redhat yum.repos.d]# echo $releasever

[root@qsing_redhat yum.repos.d]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.0 (Maipo)

所以只能手动将 $releasever替换为系统版本号,我的为redhat7

即将/etc/yum.repos.d/CentOS-Base.repo中baseurl地址中$releasever替换为7保存即可。

让后常规的更新缓存

1,yum clean all

2,yum makecache 

ok

 

 

你可能感兴趣的:(linux)