关闭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

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

<html><head>

<title>404 Not Found</title>

</head><body>

<h1>Not Found</h1>

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

<hr>

<address>Apache Server at mirrors.163.com Port 80</address>

</body></html>

强制使用IPv4

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

<?xml version="1.0" encoding="UTF-8"?>

<repomd xmlns="http://linux.duke.edu/metadata/repo">

<data type="other_db">

<checksum type="sha">c0745a5c86eabe53dfc06811be5344544a21089e</checksum>

<timestamp>1272326316</timestamp>

</data>

</repomd>

解决方案

 

以下方案二者选一即可

将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即可。