yum报错解决方法

2015-12-04 17:11:30 394

yum报错解决手记
帮别人配置环境,系统是centos 6.5 64位,用yum安装软件时一直报错,前后一共遇到两个错误:
错误1:
[root@localhost yum.repos.d]# yum install telnet 
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
http://www.landui.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
错误2:

[root@localhost etc]# yum install telnet 
Loaded plugins: fastestmirror, security
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. $releasever is not a valid and current release or hasnt been released yet/
removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
服务器的网络和dns是没问题的,yum.repo.d/Centos-Base.repo配置是默认的,其它配置文件不清楚有没有改过。

这两个错误都是和yum的$releasever变量有关,这个变量会读取centos-release包的内容,解决方法是编辑/etc/yum.conf文件,将distroverpkg改为redhat-release或者centos-release即可

vim /etc/yum.conf
distroverpkg=redhat-release 
当然,要保证服务器有centos-release包,这个包是随系统安装的,而且一般人不会干掉它

提交成功!非常感谢您的反馈,我们会继续努力做到更好!

这条文档是否有帮助解决问题?

非常抱歉未能帮助到您。为了给您提供更好的服务,我们很需要您进一步的反馈信息:

在文档使用中是否遇到以下问题: