CentOS-5的yum源无法使用解决办法

前端之家收集整理的这篇文章主要介绍了CentOS-5的yum源无法使用解决办法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

最近安装了Centos5.6,已经算是老系统了,官方不在维护更新了。
安装完毕,着手装软件,发现yum罢工了:

  1. [root@ Robinson]# yum update
  2. Loaded plugins: fastestmirror,security
  3. Loading mirror speeds from cached hostfile
  4. YumRepo Error: All mirror URLs are not using ftp,http[s] or file.
  5. Eg. Invalid release/
  6. removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt
  7. Error: Cannot find a valid baseurl for repo: base

1、将/etc/yum.repos.d/CentOS-Base.repo文件内容修改
保险一点,可以先把这个文件备份一下

  1. cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

文件内容替换为:

  1. # CentOS-Base.repo
  2. #
  3. # The mirror system uses the connecting IP address of the client and the
  4. # update status of each mirror to pick mirrors that are updated to and
  5. # geographically close to the client. You should use this for CentOS updates
  6. # unless you are manually picking other mirrors.
  7. #
  8. # If the mirrorlist= does not work for you,as a fall back you can try the
  9. # remarked out baseurl= line instead.
  10. #
  11. #
  12.  
  13. [base]
  14. name=CentOS-$releasever - Base
  15. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
  16. #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
  17. baseurl=http://vault.centos.org/5.6/os/$basearch/
  18. gpgcheck=1
  19. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
  20.  
  21. #released updates
  22. [updates]
  23. name=CentOS-$releasever - Updates
  24. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
  25. #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
  26. baseurl=http://vault.centos.org/5.6/updates/$basearch/
  27. gpgcheck=1
  28. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
  29.  
  30. #additional packages that may be useful
  31. [extras]
  32. name=CentOS-$releasever - Extras
  33. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
  34. #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
  35. baseurl=http://vault.centos.org/5.6/extras/$basearch/
  36. gpgcheck=1
  37. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
  38.  
  39. #additional packages that extend functionality of existing packages
  40. [centosplus]
  41. name=CentOS-$releasever - Plus
  42. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
  43. #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
  44. baseurl=http://vault.centos.org/5.6/centosplus/$basearch/
  45. gpgcheck=1
  46. enabled=0
  47. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
  48.  
  49. #contrib - packages by Centos Users
  50. [contrib]
  51. name=CentOS-$releasever - Contrib
  52. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
  53. #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
  54. baseurl=http://vault.centos.org/5.6/contrib/$basearch/
  55. gpgcheck=1
  56. enabled=0
  57. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

我安装的是5.6,如果你是别的版本可将5.6全文替换为你自己的版本。

2、更新源

  1. yum update

这样就好了。

本文参考:http://www.jb51.cc/article/p-alxhcpmb-bps.html

猜你在找的CentOS相关文章