当前位置:   article > 正文

【centos7】Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&i_centos 7 could not retrieve mirrorlist

centos 7 could not retrieve mirrorlist

centos7中yum报错:

  1. 已加载插件:fastestmirror
  2. Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
  3. 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"
  4. One of the configured repositories failed (未知),
  5. and yum doesn't have enough cached data to continue. At this point the only
  6. safe thing yum can do is fail. There are a few ways to work "fix" this:
  7. 1. Contact the upstream for the repository and get them to fix the problem.
  8. 2. Reconfigure the baseurl/etc. for the repository, to point to a working
  9. upstream. This is most often useful if you are using a newer
  10. distribution release than is supported by the repository (and the
  11. packages for the previous distribution release still work).
  12. 3. Disable the repository, so yum won't use it by default. Yum will then
  13. just ignore the repository until you permanently enable it again or use
  14. --enablerepo for temporary usage:
  15. yum-config-manager --disable <repoid>
  16. 4. Configure the failing repository to be skipped, if it is unavailable.
  17. Note that yum will try to contact the repo. when it runs most commands,
  18. so will have to try and fail each time (and thus. yum will be be much
  19. slower). If it is a very temporary problem though, this is often a nice
  20. compromise:
  21. yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
  22. Cannot find a valid baseurl for repo: base/7/x86_64

解决办法:

1、修改文件,vi /etc/yum.repos.d/CentOS-Base.repo ,将文件中mirrorlist开头的语句注释,将baseurl开头的语句注释删掉。

2、检查修改配置文件,vi /etc/resolv.conf:

  1. nameserver 8.8.8.8 #定义DNS服务器的IP地址
  2. search localdomain #定义域名的搜索列表

3、之后执行yum -y update就不会报错了

4、恢复 CentOS-Base.repo到原始状态(baseurl注释掉,mirrorList取消注释)

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/819001
推荐阅读
相关标签
  

闽ICP备14008679号