问题_解决CentOS 5.5 yum源不能用的问题

问题描述

yum check-update的时候,总是提示错误。按照网上的方法做处理,结果提示各种错误,大致如下:

  • YumRepo Error: All mirror URLs are not using ftp, http[s] or file
  • Error: Cannot retrieve repository metadata (repomd.xml) for repository: addons.
  • Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfi

试了网上解决方案,我的问题均未解决。最后自己试出来了,先说明下大概情况:
1.最新版的CentOS系统是7.4.1708,如图
这里写图片描述
2.国内的各大镜像站只有最新版本目录有内容,其他版本目录下仅有readme文件
3.各大镜像站下载的CentOS-Base.repo文件,放到/etc/yum.repos.d/下都用不了

解决方案

readme文件中发现http://vault.centos.org/网站是有各个版本镜像的,所以
1.通过lsb_release -a查询下,系统版本如图
这里写图片描述
2.根据查询信息,将/etc/yum.repos.d/CentOS-Base.repo中baseurl路径做调整,文件内容如下:

# 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-$releasever - Base
baseurl=http://vault.centos.org/5.5/os/i386/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#released updates 
[updates]
name=CentOS-$releasever - Updates
baseurl=http://vault.centos.org/5.5/updates/i386/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
baseurl=http://vault.centos.org/5.5/addons/i386/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://vault.centos.org/5.5/extras/i386/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://vault.centos.org/5.5/centosplus/i386/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
baseurl=http://vault.centos.org/5.5/contrib/i386/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

3.保存文件后,运行yum clean all
4.执行yum check-update测试下,ok

国内的几个yum镜像源

  1. http://ftp.sjtu.edu.cn/centos/,上海交大,但服务器位于北京,中国教育网网络中心,我看像是朝阳区那边的IP,以前在那边上过 班,下载速度高达十M。 北方用户与教育网用户推荐,速度飞快。
  2. http://centos.ustc.edu.cn,中国科技大学,服务器位于合肥。 南方用户推荐。
  3. http://mirrors.sohu.com/,sohu的开源镜像服务器,服务器位于山东省联通。 速度飞快,全国用户推荐,经常用FireFox下载CD镜像。
  4. http://mirrors.163.com/centos,网易的开源服务器镜像 速度也不错,全国用户推荐. 下载CentOS-Base-163.repo, 放入/etc/yum.repos.d/
  • 2
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值