centos yum时出现“Could not retrieve mirrorlist ”的解决办法

发布时间:2019-10-29编辑:脚本学堂
在centos中使用yum安装或更新软件时,有时会突然出现:Could not retrieve mirrorlist 的错误提示,来看下面的示例:

centos中使用yum安装或更新软件时,有时会突然出现:Could not retrieve mirrorlist 的错误提示,来看下面的示例:
[root@localhost ~]# yum -y install vsftpd (注:在下载linuxjishu/14085.html target=_blank class=infotextkey>wget命令并安装)
Could not retrieve mirrorlist
http://mirrorlist.centos.org/?release=5&arch=i386&repo=os error was [Errno 4] IOError: <urlopen error (-3, 'xe5x9fx9fxe5x90x8dxe8xa7xa3xe6x9ex90xe6x9ax82xe6x97xb6xe5xa4xb1xe8xb4xa5')> Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
 
原因分析:
未配置resolv.conf

解决方法:
到/etc目录下配置resolv.conf加入nameserver IP,如:
 

复制代码 代码如下:
nameserver 8.8.8.8
nameserver 8.8.4.4
search localdomain
 

保存,再次运行yum安装即可。