CentOS yum有时出现“Could not retrieve mirrorlist ”的解决办法——resolv.conf的配置

国内服务器在运行命令yum  update 的时候,出现:

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"
Error: Cannot find a valid baseurl for repo: base

这种错误,是因为没有配置/etc/resolv.conf

解决方法:编辑resolv.conf文件,添加:

[plain]  view plain  copy
  1. nameserver 8.8.8.8  

保存退出即可

最后记得service network restart

猜你喜欢

转载自blog.csdn.net/shadow_zed/article/details/80082585