本文转载自: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. http请求的GET和POST请求:查询和新增(server.php)

    <?php //设置页面内容是html编码格式是utf-8 header("Content-Type: text/plain;charset=utf-8"); //heade ...

  2. 网络编程之socketserver初识

    网络编程之socketserver初识 Server #!/usr/bin/env python # @Author : "Wjl" # @Date : 2017/12/22 # ...

  3. 【zznu-夏季队内积分赛3-J】追忆

    题目描述 “别人总说我瓜,其实我一点也不瓜,大多数时候我都机智的一批“现在是阳历2018/8/7,宝儿姐想起自己参加ACM整整1000天了.她想知道她刚入坑是什么时间.那么问题来了,请帮宝儿姐追忆一下 ...

  4. SpringCloud_00_资源帖

    一.官方资料 spring-cloud reference springcloud中文网 Spring Cloud 官方中文文档(dalston) 二.精选资料 1.翟永超-<Spring Cl ...

  5. 记 fastjson泛型转对象 第一次可以正常转,第二次就变成JSONArray 问题

    在解析json数据的时候,在使用泛型对象的时候即: public class ResultMsgDto<E> implements Serializable { private stati ...

  6. [Python] 项目打包发布

    一.setuptools - 官方文档: Building and Distributing Packages with Setuptools- 中文文档: Python包管理工具setuptools ...

  7. PHP简单实例

    <?php /** * @author admin * @copyright 2016 *编程实现2+4+6+…+100. * $sum = 0; for($i=2;$i<=100;$i+ ...

  8. couldn't import dot_parser

    这个错误,你不要信它,实际可以画图了.害我又降级安装,真是气死了.

  9. crm 03--> crm与权限结合

    ---恢复内容开始--- 1:先分组 2:给权限分组 3:具体的权限(即设计url) 二:制作左侧菜单,显示当前用户拥有的权限 关于项目下的templates里的HTML查找顺序 先从根目录找,找不到 ...

  10. swift 数组作为函数参数的书写格式

    数组定义 --[来自百度知道] Swift语言使用类型名紧接中括号[]来简化标准库中定义的命名型类型Array.例如 Array<String> = ["Alex", ...