One of the configured repositories failed (未知), and yum doesn‘t hav ...

打印 上一主题 下一主题

主题 770|帖子 770|积分 2310

centos操作体系运行yum命令是出现如下报错:

解决办法:

由于CentOS的源地址内容已移除,CentOS 操作体系结束了生命周期,源地址内容已移除。
只需要将它的base源换成其他可用源,我这里将它换成了阿里的base源
备份原来的源:

  1. mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
复制代码
执行如下命令安装新的源:

  1. wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
复制代码
重新执行yum相关命令,就可以正常使用了。
若显示wget命令不存在

需手动替换CentOS-Base.repo这个文件,替换成如下内容,发起直接复制粘贴替换原文件的内容,cat写入可能不生效:
  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. [base]
  13. name=CentOS-$releasever - Base - mirrors.aliyun.com
  14. failovermethod=priority
  15. baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
  16.         http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
  17.         http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
  18. gpgcheck=1
  19. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  20. #released updates
  21. [updates]
  22. name=CentOS-$releasever - Updates - mirrors.aliyun.com
  23. failovermethod=priority
  24. baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
  25.         http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
  26.         http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
  27. gpgcheck=1
  28. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  29. #additional packages that may be useful
  30. [extras]
  31. name=CentOS-$releasever - Extras - mirrors.aliyun.com
  32. failovermethod=priority
  33. baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
  34.         http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
  35.         http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
  36. gpgcheck=1
  37. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  38. #additional packages that extend functionality of existing packages
  39. [centosplus]
  40. name=CentOS-$releasever - Plus - mirrors.aliyun.com
  41. failovermethod=priority
  42. baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
  43.         http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
  44.         http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
  45. gpgcheck=1
  46. enabled=0
  47. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  48. #contrib - packages by Centos Users
  49. [contrib]
  50. name=CentOS-$releasever - Contrib - mirrors.aliyun.com
  51. failovermethod=priority
  52. baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
  53.         http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
  54.         http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
  55. gpgcheck=1
  56. enabled=0
  57. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
复制代码
 末了执行如下命令完成:
  1. yum clean all
  2. yum makecacahe
复制代码
删除其他库

若还是无法运行yum ,检察base是否存在任何本地存储库或任何其他媒体存储库,如有别的的先删除其他的,命令:
  1. ll /etc/yum.repos.d
复制代码

删除CentOS7-Base-163.repo这个base源:
  1. rm -rf /etc/yum.repos.d/CentOS7-Base-163.repo
复制代码
再次运行如下命令:
  1. yum clean all
  2. yum makecacahe
复制代码
希望对你有资助,若遇到其他环境请留言,我看到了会第一时间回复。

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

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

本版积分规则

曹旭辉

金牌会员
这个人很懒什么都没写!

标签云

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