解决近期linux下yum更新出现HTTP Error 404 NOT FOUND错误的办法
Posted by neilxp on 十月 28, 2010 Leave a comment (3) Go to comments最近两天使用yum的163源,出现404错误1 [root@localhost yum.repos.d]# yum makecache2 ...3 ...4 http://mirrors.163.com/centos/5/os/i386/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found5 Trying other mirror.6 ...用浏览器却可以打开http://mirrors.163.com/centos/5/os/i386/repodata/repomd.xml这个文件。后来发现是ipv6的问题,使用curl,不带-4参数也是404错误,使用-4参数后就能访问到该文件。01 [root@localhost yum.repos.d]# curl http://mirrors.163.com/centos/5/os/i386/repodata/repomd.xml02 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">03 <html><head>04 <title>404 Not Found</title>05 </head><body>06 <h1>Not Found</h1>07 <p>The requested URL /centos/5/os/i386/repodata/repomd.xml was not found on this server.</p>08 <hr>09 <address>Apache Server at mirrors.163.com Port 80</address>10 </body></html>强制使用IPv401 [root@localhost yum.repos.d]# curl http://mirrors.163.com/centos/5/os/i386/repodata/repomd.xml -402 <?xml version="1.0" encoding="UTF-8"?>03 <repomd xmlns="http://linux.duke.edu/metadata/repo">04 <data type="other_db">05 ...06 ...07 <checksum type="sha">c0745a5c86eabe53dfc06811be5344544a21089e</checksum>08 <timestamp>1272326316</timestamp>09 </data>10 </repomd>解决方案以下方案二者选一即可 将mirrors.163.com的IPv4地址写入到/etc/hosts文件 1 [root@localhost ~]# echo `host mirrors.163.com|cut -d' ' -f 4` mirrors.163.com >> /etc/hosts 重命名/lib/modules/2.6.x/kernel/net/ipv6后重启。 1 [root@localhost ~]# mv /lib/modules/2.6.x/kernel/net/ipv6 /lib/modules/2.6.x/kernel/net/ipv6.bak 2 [root@localhost ~]# init 6ps: 如果你在你的linux机器上用git clone复制sourceforge.net的源代码时,提示密码错误,而Windows上同样的密码可以,也是这个问题,使用方案2即可。