本文转载自: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>

解决方案

以下方案二者选一即可

  1. 将mirrors.163.com的IPv4地址写入到/etc/hosts文件
[root@localhost ~]# echo `host mirrors.163.com|cut -d' ' -f 4` mirrors.163.com >> /etc/hosts

2.重命名/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即可。

再PS:

查了一下,发现 CentOS 5 在2017-03-31日已经结束支持,不再提供维护更新,所以包括阿里云镜像站的文件可能都是过时或已经有部分文件缺失。

这样的话只好把yum源的地址切换到目前还能用的: http://vault.centos.org/5.11/

解决近期linux下yum更新出现HTTP Error 404 NOT FOUND错误的办法的更多相关文章

  1. Linux下yum安装MySQL

    写这篇文章的原因是:在刚开始使用Linux操作系统时想要搭建LAMP环境,于是开始在Google和百度上各种寻找资料,碰到了不是很多的问题后,我决定写这篇文章总结一下在Linux下yum安装MySQL ...

  2. 解决在Linux下安装Oracle时的中文乱码问题

    本帖最后由 TsengYia 于 2012-2-22 17:06 编辑 解决在Linux下安装Oracle时的中文乱码问题 操作系统:Red Hat Enterprise Linux 6.1数据库:O ...

  3. [转帖]linux 下yum使用技巧

    linux 下yum使用技巧 https://www.cnblogs.com/galengao/p/5750389.html 本文来自我的github pages博客http://galengao.g ...

  4. 【夯实PHP基础系列】linux下yum安装PHP APC

    Alternative PHP Cache(可选PHP缓存),依赖于 PECL扩展库 用源码方式安装,直接yum就行了:首先要安装apc的依赖包:yum install php-pear php-de ...

  5. 解决redhat linux下IP地址可以ping通,域名无法ping通问题

    解决redhat linux下IP地址可以ping通,域名无法ping通 在/etc/resolv.conf中添点东西 格式如下: nameserver xxx.xxx.xxx.xxx nameser ...

  6. 终于解决了Linux下运行OCCI程序一直报Error while trying to retrieve text for error ORA-01804错误

    终于解决了Linux下运行OCCI程序一直报Error while trying to retrieve text for error ORA-01804错误 http://blog.csdn.net ...

  7. Dcloud课程6 php脚本如何在Linux下定时更新数据

    Dcloud课程6 php脚本如何在Linux下定时更新数据 一.总结 一句话总结:linux下用crontab命令实现定时任务. 1.linux下执行php脚本用什么命令? 直接用php命令php ...

  8. linux下yum安装python3

    linux下yum安装python3 linux下yum安装python3yum install python34 -ypython3 --version wget --no-check-certif ...

  9. linux下安装svn出现configure: error: We require OpenSSL; try --with-openssl

    linux下安装svn出现configure: error: We require OpenSSL; try --with-openssl http://blog.csdn.net/woshixion ...

随机推荐

  1. HTML条件注释判断浏览器版本命令

    <!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]--> <!--[if IE]> 所有的IE可识别 <![ ...

  2. 2016年度,这40项IT技能年薪轻松超过10万美元

    众所周知,科技行业聚集了大批高薪职位,但这同样也是一个快速变化的市场.今天的热门技能明天就有可能惨遭淘汰. 求职网站Dice.com最近发布了<2016薪酬调查>, 列举了年薪最高的各种科 ...

  3. LeetCode OJ:Maximal Rectangle(最大矩形)

    Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and ...

  4. [转载]Spring源码下载地址

    转载自:http://blog.csdn.net/liuzheng2684/article/details/6534722,谢谢! 今天想下载一下spring的源代码,登录到Spring官网,傻眼了, ...

  5. Chrome浏览器优化技巧

    Chrome浏览器开发者工具Network窗口下,可以查看下载各组件所需的具体时间 根据上表进行简要分析—— Stalled(阻塞) 浏览器对同一个主机域名的并发连接数有限制,因此如果当前的连接数已经 ...

  6. vue--踩坑

    1.通过computed计算属性,计算过的值,假如传递给子组件,在子组件中修改是不起作用的.

  7. macOS 下安装SDKMAN 软件开发工具包管理器

    SDKMAN 软件开发工具包管理器的安装非常简单,只需要打开终端,执行: $ curl -s "https://get.sdkman.io" | bash 就OK了,输出类似如下: ...

  8. kmeans实现文本聚类

    需求 拿到的需求是输入n个文本,对文本进行聚类,由于这些输入不能通过历史数据进行训练,所以这个主要就是用无监督学习来解决. kmeans 谈到聚类就会想到kmeans,它的核心思想是给定的K值和K个初 ...

  9. [置顶] Isolation Forest算法实现详解

    本文算法完整实现源码已开源至本人的GitHub(如果对你有帮助,请给一个 star ),参看其中的 iforest 包下的 IForest 和 ITree 两个类: https://github.co ...

  10. jQuery扩展 模糊删除sessionStroage

    $.extend({ removeStorageLike : function(name){ //模糊删除 for(var k in sessionStorage){ if(k.indexOf(nam ...