yum install后报错 curl#37 - “Couldn‘t open file /media/cdrom/repodata/repomd.xml“


一、报错如下

One of the configured repositories failed (CentOS-7 - Media),
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=c7-media ...

 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 c7-media
    or
        subscription-manager repos --disable=c7-media

 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=c7-media.skip_if_unavailable=true

failure: repodata/repomd.xml from c7-media: [Errno 256] No more mirrors to try.
file:///media/CentOS/repodata/repomd.xml: [Errno 14] curl#37 - “Couldn’t open file /media/CentOS/repodata/repomd.xml”
file:///media/cdrecorder/repodata/repomd.xml: [Errno 14] curl#37 - “Couldn’t open file /media/cdrecorder/repodata/repomd.xml”
file:///media/cdrom/repodata/repomd.xml: [Errno 14] curl#37 - “Couldn’t open file /media/cdrom/repodata/repomd.xml”

二、解决方式

1.重建缓存

yum cleam all

yum makecache

2.DNS的问题

在这里插入图片描述

# ls /etc/sysconfig/network-scripts/
# vim /etc/sysconfig/network-scripts/ifcfg-ens33
# service network restart 
# cat /etc/resolv.conf   查下
  # Generated by NetworkManager
nameserver 192.168.118.2
nameserver 114.114.114.114

不过本身可以连外网,这个应该不存在的

3、因为yum 寻包的顺序应该先是本地源,再寻网络源。

所以需要修改配置文件,解决办法就是把本地源关闭:

# vim /etc/yum.repos.d/CentOS-Media.repo
将里面的enabled=1改成enabled=0,然后保存退出。

在这里插入图片描述
完了之后执行 yum makecache,如果能重建缓存,说明解决了

查看yum源

# ll /etc/yum.repos.d/
总用量 60
-rw-r--r--. 1 root root 1664 1023 2020 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 1023 2020 CentOS-CR.repo
-rw-r--r--. 1 root root  649 1023 2020 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  314 1023 2020 CentOS-fasttrack.repo
-rw-r--r--  1 root root  630 77 06:33 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 1023 2020 CentOS-Sources.repo
-rw-r--r--. 1 root root 8515 1023 2020 CentOS-Vault.repo
-rw-r--r--. 1 root root  616 1023 2020 CentOS-x86_64-kernel.repo
-rw-r--r--. 1 root root 1919 610 01:21 docker-ce.repo
-rw-r--r--. 1 root root  951 103 2017 epel.repo
-rw-r--r--. 1 root root 1050 103 2017 epel-testing.repo
-rw-r--r--. 1 root root   85 1130 2016 jenkins.repo
-rw-r--r--  1 root root  897 75 22:37 zabbix.repo


5、如果上面还不能解决,估计要重新安装yum了,附一个链接:

https://blog.csdn.net/shaoqiufeng/article/details/78785806

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ives

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值