yum install 报错[Errno 14] curl#37 - “Couldn‘t open file /mnt/cdrom/repodata/repomd.xml“

本文记录了在CentOS7系统中遇到的yum安装问题及解决方案。首先尝试了清除缓存和重新缓存,但问题依旧。接着怀疑是DNS问题,修改了DNS设置,但问题未解决。然后发现本地源配置问题,关闭本地源并新增了CentOS-Base.repo文件,选择了中科大或清华的镜像源。最后执行清理和缓存命令,成功解决问题。
摘要由CSDN通过智能技术生成

最近在玩centos7,之前装系统没太注意yum这个东东,今天想用yum install 一个东西,结果报[Errno 256] No more mirrors to try,所以就是:

 

1、然后按照网上的一些修改,先是执行:

yum cleam all

然后 yum makecache,问题还是没解决,继续报错。

其实这两条命令就是清空缓存,然后再重新缓存的意思,有时候可能有效。但在我这边又报了[Errno 14] curl#37 - "Couldn't open file /mnt/cdrom/repodata/repomd.xml",如下图:

2、然后又尝试了方法,说是DNS的问题,上不了网。又去改了DNS(可以去尝试尝试,因为不同人遇到问题不一样)。

第二种情况是针对网络DNS出问题的时候的解决办法,如果之前本身就没有问题,说明这样是解决不了的。

如果是绑定了静态地址,直接修改/etc/resolv.conf   这个文件下的DNS是没有用的,因为你执行命令service network restart 会恢复。所以要修改网卡的配置文件,先到对应的目录下:

# cd /etc/sysconfig/network-scripts/

# ll 查看网卡,因为有可能有几块网卡。

#vi  ifcfg-enp7s0f1,在里面注释掉原来的DNS1或者加一个DNS2(有些说改成8.8.8.8)

# service network restart 重启网络,用cat /etc/resolv.conf 发现DNS改变了。

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

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

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

完了之后执行 yum makecache,如果能缓存,说明解决了,如果像我一样出现如下错误。说明yum源出了问题。

 后来发现自己的文件夹少了CentOS-Base.repo这个源,不知道为什么安装系统时没有安装,自己新建一个CentOS-Base.repo文件

# vi  /etc/yum.repos.d/CentOS-Base.repo

以下数据源二选一(推荐中科大)

1、中科大(参考地址:http://mirrors.ustc.edu.cn/help/centos.html#)

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#released updates
[updates]
name=CentOS-$releasever - Updates
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

2、清华源


# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

修改完成后执行:

# yum clean all

# yum makecache

 

 问题解决,帮自己做了个笔记,希望对大家也有帮助

  • 8
    点赞
  • 35
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
"failed to connect to 127.0.0.1 port 7890 after 20000 ms: Couldn't connect to server" 这个错误通常是由于无法连接到指定的服务器引起的。根据引用、和的内容,可能的原因可能是以下几种: 1. 系统代理:你可能已经在系统中设置了代理,而代理服务器无法连接到指定的端口。你可以尝试关闭系统代理或者确保代理服务器的设置是正确的。 2. 网络连接问题:可能是由于网络连接不稳定或者防火墙设置导致无法连接到指定的服务器。你可以尝试检查网络连接是否正常,并确保防火墙允许与服务器的通信。 3. 服务器故障:指定的服务器可能暂时不可用或者出现故障。你可以尝试等待一段时间并重新连接,或者联系服务器管理员进行进一步的排查。 综上所述,"failed to connect to 127.0.0.1 port 7890 after 20000 ms: Couldn't connect to server"错误的原因可能是系统代理设置、网络连接问题或者服务器故障。你可以尝试根据具体情况排查并解决问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [如何解决:Failed to connect to github.com port 443 after 21098 ms: Timed out](https://blog.csdn.net/weixin_43666333/article/details/129904391)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [解决 github项目clone报错 Failed connect to github.com:443; Connection](https://download.csdn.net/download/weixin_38714641/14053810)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [curl: (7) Failed to connect to 127.0.0.1 port 1081 after 3 ms: Couldn‘t connect to server](https://blog.csdn.net/kdksz/article/details/129739103)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值