centos修改dns解决yum升级错误的方法

Server 林涛 12580℃ 0评论

在新机器上安装了centos5.5,但是升级的时候出现了错误。

[root@localhost ~]# yum -y update
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: <urlopen error (-3, '\xe5\x9f\x9f\xe5\x90\x8d\xe8\xa7\xa3\xe6\x9e\x90\xe6\x9a\x82\xe6\x97\xb6\xe5\xa4\xb1\xe8\xb4\xa5')>
Error: Cannot find a valid baseurl for repo: addons


这个错误信息中的 fastestmirror是指 fastestmirror插件,用来在yum更新的时候根据ping判断相应最快的镜像下载,所以第一步不要先屏蔽 fastestmirror插件,而是先检查一下是否是dns错误。

首先ping一下mirrorlist.centos.org ,看是否通畅,ping一下www.ctohome.com是否通畅,多ping一下其他站点,如果出现断断续续或者不通,这说明是dns的设置问题。

修改dns只要需要修改/etc/resolv.conf文件,直接一个dns服务器即可,可以用下面你的命令:


echo "nameserver 8.8.8.8" >> /etc/resolv.conf

nameserver 是修改dns的命令:


nameserver 8.8.8.8 #google域名服务器
nameserver 8.8.4.4 #google域名服务器

如需转载请注明: 转载自26点的博客

本文链接地址: centos修改dns解决yum升级错误的方法

转载请注明:26点的博客 » centos修改dns解决yum升级错误的方法

喜欢 (1)
发表我的评论
取消评论

表情