网硕互联技术交流社区

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 4101|回复: 0

CentOS-5(XenCenter6.5)的yum源无法使用解决办法

[复制链接]

4

主题

4

帖子

42

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
42
发表于 2017-12-26 13:42:17 | 显示全部楼层 |阅读模式
  1. [root@37wan ~]# yum -y install gcc
  2. Loaded plugins: fastestmirror
  3. Determining fastest mirrors
  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
复制代码
可以看出:URLs不是ftp或http地址,打开yum查看:
  1. [base]
  2. name=CentOS-$releasever - Base
  3. mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
  4. #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
  5. gpgcheck=1
  6. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
复制代码
  1. [root@ yum.repos.d]# wget mirrorlist=http://mirrorlist.centos.org/6release=$releasever&arch=$basearch&repo=os  
  2. [1] 4853  
  3. [2] 4854  
  4. [root@ yum.repos.d]# mirrorlist=http://mirrorlist.centos.org/6release=: Unsupported scheme.  
复制代码
即源的网址有问题。
更新文件内容,用以下内容替换:

  1. # The mirror system uses the connecting IP address of the client and the  
  2. # update status of each mirror to pick mirrors that are updated to and  
  3. # geographically close to the client.  You should use this for CentOS updates  
  4. # unless you are manually picking other mirrors.  
  5. #  
  6. # If the mirrorlist= does not work for you, as a fall back you can try the   
  7. # remarked out baseurl= line instead.  
  8. #  
  9. #  


  10. [base]  
  11. name=CentOS-$releasever - Base  
  12. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os  
  13. #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/  
  14. baseurl=http://vault.centos.org/5.11/os/$basearch/  
  15. gpgcheck=1  
  16. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5  


  17. #released updates   
  18. [updates]  
  19. name=CentOS-$releasever - Updates  
  20. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates  
  21. #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/  
  22. baseurl=http://vault.centos.org/5.11/updates/$basearch/  
  23. gpgcheck=1  
  24. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5  


  25. #additional packages that may be useful  
  26. [extras]  
  27. name=CentOS-$releasever - Extras  
  28. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras  
  29. #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/  
  30. baseurl=http://vault.centos.org/5.11/extras/$basearch/  
  31. gpgcheck=1  
  32. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5  




  33. #additional packages that extend functionality of existing packages  
  34. [centosplus]  
  35. name=CentOS-$releasever - Plus  
  36. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus  
  37. #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/  
  38. baseurl=http://vault.centos.org/5.11/centosplus/$basearch/  
  39. gpgcheck=1  
  40. enabled=0  
  41. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5  




  42. #contrib - packages by Centos Users  
  43. [contrib]  
  44. name=CentOS-$releasever - Contrib  
  45. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib  
  46. #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/  
  47. baseurl=http://vault.centos.org/5.11/contrib/$basearch/  
  48. gpgcheck=1  
  49. enabled=0  
  50. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
复制代码

最后再将/etc/yum.repos.d/Citrix.repo改名
  1. mv Citrix.repo Citrix.repo_bak
复制代码

清空yum源缓存:
  1. yum clean all #清空yum源缓存
  2. yum makecache #从新加载新缓存
复制代码

通过yum list 测试yum是否可用

  1. yum list
复制代码


用国内的yum源会出现一下问题,用上述解决办法,也ok,虽然会有一个连接报错

  1. http://mirrors.aliyun.com/centos/5/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found
复制代码
用浏览器打开http://mirrors.aliyun.com/centos/5/os/x86_64/repodata/repomd.xml,根本找不到这个文件,163…阿里…也是,但是Centos6内有,说明国内也不支持Centos5了!

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|网硕互联技术交流社区

GMT+8, 2024-4-26 21:27 , Processed in 0.236060 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表