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

    • 问题描述
    • 解决方案
      • 国内的几个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,如图
问题_解决CentOS 5.5 yum源不能用的问题_第1张图片
2.国内的各大镜像站只有最新版本目录有内容,其他版本目录下仅有readme文件
3.各大镜像站下载的CentOS-Base.repo文件,放到/etc/yum.repos.d/下都用不了

解决方案

readme文件中发现http://vault.centos.org/网站是有各个版本镜像的,所以
1.通过lsb_release -a查询下,系统版本如图
问题_解决CentOS 5.5 yum源不能用的问题_第2张图片
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/

你可能感兴趣的:(linux)