Centos5.x老版本 Loaded plugins: fastestmirror错误解决

Centos5.x老版本 Loaded plugins: fastestmirror错误解决

Centos5.x老版本使用yum遇到如下错误

错误1:

# yum update wget
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Update Process
No Packages marked for Update

错误2:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.xxx.edu.cn
 * extras: centos.xxx.edu.cn
 * updates: centos.xxx.edu.cn
Setting up Install Process
No package git available.
Nothing to do

错误3:
使用wget报如下错误

Unable to establish SSL connection.

以上问题都是因为要更新镜像源

解决方法1: 更新镜像源

进入yum源配置文件所在的文件夹

# cd /etc/yum.repos.d/

首先备份系统自带yum源配置文件/etc/yum.repos.d/CentOS-Base.repo

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

下载163的yum源配置文件

源地址: http://mirrors.163.com/centos/ 根据你系统的版本选择对应的源,查看版本的方式

# cat /etc/redhat-release

或者

# uname -a

用下载的源替换/etc/yum.repos.d/CentOS-Base.repo

运行yum makecache生成缓存

# yum makecach

以上是正常情况,如果遇到5.x的老版本,有的在163、阿里源里面是找不到的,需要去这里找http://vault.centos.org/

替换

baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/

中的http://mirrors.163.com/centos为http://vault.centos.org/

$releasever表示当前的版本号,如果需要的话也可以手动写死。

下面是我修改后的centos 5.10版本的官方源。

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-5.10 - Base 
baseurl=http://vault.centos.org/5.10/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=5.10&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#released updates 
[updates]
name=CentOS-5.10 - Updates 
baseurl=http://vault.centos.org/5.10/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=5.10&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-5.10 - Extras 
baseurl=http://vault.centos.org/5.10/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=5.10&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5.10 - Plus 
baseurl=http://vault.centos.org/5.10/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=5.10&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-5.10 - Contrib 
baseurl=http://vault.centos.org/5.10/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=5.10&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

替换好源后,运行yum makecach更新一下就可以了。

如果还是无法访问网站,则ping 一下百度通不通 ping www.baidu.com

不通的话就是DNS解析问题

# vi /etc/resolv.conf 

nameserver  8.8.8.8
nameserver 114.114.114.114

解决方法2:更新补丁

下载https://archives.fedoraproject.org/pub/archive/epel/5/x86_64/epel-release-5-4.noarch.rpm 文件,在Centos里面安装

这里需要注意的是,要选对自己系统所对应的版本

 rpm -ivh epel-release-5-4.noarch.rpm

《Centos5.x老版本 Loaded plugins: fastestmirror错误解决》有1条留言

  1. 更新完CentOS-Base.repo后yum makecache看效果,如果报错看一下错误信息,可能是两种情况:
    1、你系统使用的不是CentOS-Base.repo,找到系统使用的repo文件,比如XENServer DDK中使用的是 Citrix.repo ,打开 Citrix.repo,将enable置为0。
    2、看看能够ping通你设置的源的网站,可能是网络、DNS配置问题。

留下评论

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据