新爱的圈套泰剧:CentOS6修改yum源到163源

来源:百度文库 编辑:偶看新闻 时间:2024/05/10 19:45:22

关闭fastestmirror

“vi /etc/yum/pluginconf.d/fastestmirror.conf”     and set “enable=0″

cd /etc/yum.repos.d/ 

wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
yum makecache 
yum update

 

更新出现HTTP Error 404 NOT FOUND错误的办法 :  http://tech.lezi.com/archives/47

最近两天使用yum的163源,出现404错误

 

[root@localhost yum.repos.d]# yum makecache

http://mirrors.163.com/centos/5/os/i386/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found

Trying other mirror.

...

用浏览器却可以打开http://mirrors.163.com/centos/5/os/i386/repodata/repomd.xml这个文件。后来发现是ipv6的问题,使用curl,不带-4参数也是404错误,使用-4参数后就能访问到该文件。

[root@localhost yum.repos.d]# curl http://mirrors.163.com/centos/5/os/i386/repodata/repomd.xml

404 Not Found

Not Found

The requested URL /centos/5/os/i386/repodata/repomd.xml was not found on this server.


Apache Server at mirrors.163.com Port 80

强制使用IPv4

[root@localhost yum.repos.d]# curl http://mirrors.163.com/centos/5/os/i386/repodata/repomd.xml -4

c0745a5c86eabe53dfc06811be5344544a21089e

1272326316

解决方案

 

以下方案二者选一即可

将mirrors.163.com的IPv4地址写入到/etc/hosts文件

[root@localhost ~]# echo `host mirrors.163.com|cut -d' ' -f 4` mirrors.163.com >> /etc/hosts

 

重命名/lib/modules/2.6.x/kernel/net/ipv6后重启。

[root@localhost ~]# mv /lib/modules/2.6.x/kernel/net/ipv6 /lib/modules/2.6.x/kernel/net/ipv6.bak

[root@localhost ~]# init 6

ps: 如果你在你的linux机器上用git clone复制sourceforge.net的源代码时,提示密码错误,而Windows上同样的密码可以,也是这个问题,使用方案2即可。