zoukankan      html  css  js  c++  java
  • 配置YUM源出现Errno 14 Could not open/read repomd.xml 或者 "Couldn't open file /mnt/cdrom/repodata/repomd.xml" 错误的解决办法

    报错信息:

    [root@tcljr-jdh-uat007 yum.repos.d]# yum makecache
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    file:///mnt/cdrom/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /mnt/cdrom/repodata/repomd.xml"
    Trying other mirror.
    
    
     One of the configured repositories failed (xdn),
     and yum doesn't have enough cached data to continue. At this point the only
     safe thing yum can do is fail. There are a few ways to work "fix" this:
    
         1. Contact the upstream for the repository and get them to fix the problem.
    
         2. Reconfigure the baseurl/etc. for the repository, to point to a working
            upstream. This is most often useful if you are using a newer
            distribution release than is supported by the repository (and the
            packages for the previous distribution release still work).
    
         3. Run the command with the repository temporarily disabled
                yum --disablerepo=xdn ...
    
         4. Disable the repository permanently, so yum won't use it by default. Yum
            will then just ignore the repository until you permanently enable it
            again or use --enablerepo for temporary usage:
    
                yum-config-manager --disable xdn
            or
                subscription-manager repos --disable=xdn
    
         5. Configure the failing repository to be skipped, if it is unavailable.
            Note that yum will try to contact the repo. when it runs most commands,
            so will have to try and fail each time (and thus. yum will be be much
            slower). If it is a very temporary problem though, this is often a nice
            compromise:
    
                yum-config-manager --save --setopt=xdn.skip_if_unavailable=true
    
    failure: repodata/repomd.xml from xdn: [Errno 256] No more mirrors to try.
    file:///mnt/cdrom/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /mnt/cdrom/repodata/repomd.xml"
    [root@tcljr-jdh-uat007 yum.repos.d]# cd /mnt/repo
    -bash: cd: /mnt/repo: No such file or directory

    上述中的repodata/repomd.xml文件据说是/mnt目录rpm包的目录,路径

    在/mnt中因为没有/repodata/repomd.xml 这个文件,所以提示出错,其实不是网上所说的软件库路径的问题。这也是明明在/mnt下看到我们要安装的包,而提示没有的缘故。

    解决办法:

    网上有各种办法:

    第一种:解决办法就是把本地源关闭:将/etc/yum.repos.d/CentOS-Media.repo里面的enabled=1改成enabled=0即可,因为yum寻包的顺序应该先是本地源,再寻网络源。

    第二种:解决方法就是重新配置生成repomd.xml文件。
    以上述base为例,生成新的repomd.xml:

    [root@yanta ~]# cd /mnt/repo

    [root@yanta repo]# creatrepo ./base/

    或许各自的实际情况不一样,上述方法并没有解决问题,经过一番验证后,发现另一种方法:通过一台正常服务器,获取yun源文件,然后替换该服务器yum源文件,结果正常了;

    提供正常使用yum源文件:https://download.csdn.net/download/yang5726685/75666689

    操作前可以先备份原有的yum源,然后替换即可,替换路径为:

    /etc/yum.repos.d

    清除缓存 生成新的缓存

    yum clean all
    
    yum makecache

    最后,通过命令查看配置好的yum源是否正常:yum repolist。

  • 相关阅读:
    今天还做了点有意义的事
    读“记当年的公开课”
    无语
    小议如何控制学生机结束学生端多媒体控制平台程序
    今天去了中山
    Windows服务创建及安装
    SQL Server数据库表锁定原理以及如何解除表的锁定示例演示
    本地SQL脚本操作外部服务器结果集
    list.FindAll
    一个高效的数据分页的存储过程 可以轻松应付百万数据
  • 原文地址:https://www.cnblogs.com/yang5726685/p/15797979.html
Copyright © 2011-2022 走看看