當安裝Centos系統之後,使用yum原時出以下錯誤:
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=addons error was
原因是找不到鏡像的問題,DNS服務器沒有配置好。
#vi /etc/resolv.conf
Nameserver 192.168.200.1 //校園Dns
Nameserver 8.8.8.8 //谷歌域名服務器,使用其他源的時候,都正常解析域名了
Nameserver 8.8.4.4 //谷歌域名
保存退出
最後:#servicenetwork restart
另外一種方法比較麻煩:
# mv /etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.backup
# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo //當wget沒有安裝的時候,只有通過U盤把源複製到系統
# mv CentOS6-Base-163.repo/etc/yum.repos.d/CentOS6-Base-163.repo
# yum makecache
建設採用第一種方法之後再採用第二種方法更改到對應的yum源,以後執行效率更高。