• 解决近期linux下yum更新出现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>

    解决方案

    以下方案二者选一即可

    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/ 

  • 相关阅读:
    delphi string 到excel
    VS 快捷键
    delphi Tform 释放
    cxSplitter 收缩和展开
    delphi 加载inc文件
    delphi TcxPageControl 动态嵌入窗体
    修改tomcat-users.xml 失效的问题
    TCXGRID 属性解释
    suse 设置ftp服务器
    用正则表达式修改html字符串的所有div的style样式
  • 原文地址:https://www.cnblogs.com/wpcnblog/p/8027877.html
Copyright © 2020-2023  润新知