CentOS 5下yum运行失败

公司服务器是CentOS 5的,最近在使用yum安装软件的时候报出了一下的异常

Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/
removing mirrorlist with no valid mirrors: /var/cache/yum/extras/mirrorlist.txt
Cannot find a valid baseurl for repo: extras

不论是install/update/clean等,都会出现以上错误。找了很久,最后终于在linuxquestions上找到了答案。

执行下面三行命令即可解决问题

echo "http://vault.centos.org/5.11/os/x86_64/" > /var/cache/yum/base/mirrorlist.txt
echo "http://vault.centos.org/5.11/extras/x86_64/" > /var/cache/yum/extras/mirrorlist.txt
echo "http://vault.centos.org/5.11/updates/x86_64/" > /var/cache/yum/updates/mirrorlist.txt

其根本原因是,CentOS 5已经不再进行维护了,所以之前自带的Base源已经不可访问了,而vault.centos.org下面提供的目前最后一版的源。官方公告如下:

This directory (and version of CentOS) is depreciated.  

CentOS-5 is now past EOL

You can get the last released version of centos 5.11 here:

http://vault.centos.org/5.11/

Please NOTE:  this is not being maintained for security since moving to Vault.
It will have security issues, you should upgrade to a new version instead.

理论上来说,CentOS 5该更新了,奈何是公司服务器,运行的东西太多,重装的话比较麻烦,只好将就着用了。

你可能感兴趣的:(miscellaneous)