> CentOS > CentOS故障 >

CentOS yum时出现"Could not retrieve mirrorlist"的解决办法

CentOS yum时出现"Could not retrieve mirrorlist"的解决办法
上传者:wangdl2007    
我也要“分享赚钱”2013/3/9关注(2462)评论(0)·注册就送50元:温商贷 - 全国首家挂牌P2P     ·储金所:首次注册即送158元

·好利友,有好礼:万元红包等着你!        ·汇通易贷:10秒注册,百万红包Duang砸!

>CentOS yum时出现“Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=5&arch=i386&repo=addons error ”错误:

[root@server mysql-5.0.56]# yum install gcc
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=5&arch=i386&repo=addons error was
[Errno 4] IOError:
Error: Cannot find a valid baseurl for repo: addons
发现原来是没有配置resolv.conf,于是到/etc目录下配置resolv.conf加入nameserver IP:
[root@server mysql-5.0.56]# vi /etc/resolv.conf
nameserver 218.85.157.99
search localdomain
保存resolv.conf,再次运行上面命令就可以。
[root@server mysql-5.0.56]# yum install gcc
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* updates: centos.ustc.edu.cn
addons                                                   |  951 B     00:00    
addons/primary                                           |  202 B     00:00    
base                                                     | 1.1 kB     00:00    
base/primary                                             | 961 kB     00:06    
base                                                                  2705/2705
extras                                                   | 2.1 kB     00:00    
extras/primary_db                                        | 171 kB     00:00    
updates                                                  | 1.9 kB     00:00     
..........................................................................................
.................................................................................
................................................................
(责任编辑:IT)