http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could...

本文记录了在虚拟机中遇到的网络问题,包括yum无法下载和ping不通114的情况。经过排查,问题源于虚拟机网络设置从桥接到NET的改变,改回NET连接后网络恢复正常。

今天准备用虚拟机安装docker发现yum下载不能用了

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                               | 6.1 kB  00:00:00     
 * epel: mirrors.yun-idc.com
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error"
Trying other mirror.


 One of the configured repositories failed (CentOS-7),
 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
当在CentOS 7系统访问阿里云镜像源`repodata/repomd.xml`文件报错`[Errno 256] No more mirrors to try. [Errno 14] curl#6 - Could not resolve host`时,可尝试以下解决办法: ### 1. 检查网络连接 需要确保系统网络连接正常,可通过以下命令测试网络连通性: ```bash ping www.baidu.com ``` 若无法ping通,需检查网络配置和物理连接。 ### 2. 检查DNS配置 若网络连接正常,但仍无法解析主机名,可能是DNS配置存在问题。可编辑`/etc/resolv.conf`文件,添加可靠的DNS服务器,例如阿里云的公共DNS: ```bash sudo vi /etc/resolv.conf ``` 在文件中添加以下内容: ```plaintext nameserver 223.5.5.5 nameserver 223.6.6.6 ``` 保存并退出文件后,再次尝试访问镜像源。 ### 3. 替换镜像源协议 若存在证书问题,可将镜像源的`https`协议替换为`http`协议。使用以下命令替换`/etc/yum.repos.d/docker-ce.repo`文件中的`https`为`http`: ```bash sudo sed -i 's#https://mirrors.aliyun.com#http://mirrors.aliyun.com#g' /etc/yum.repos.d/docker-ce.repo ``` 然后更新yum缓存: ```bash sudo yum clean all sudo yum makecache fast ``` ### 4. 更换国内yum源 可尝试更换为国内其他可靠的yum源,如阿里源: ```bash wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo ``` ### 5. 使用阿里云EPEL7镜像 若报错涉及EPEL镜像源,可使用阿里云EPEL7镜像。执行以下命令: ```bash sudo tee /etc/yum.repos.d/epel.repo > /dev/null <<EOF [epel] name=Extra Packages for Enterprise Linux 7 - \$basearch baseurl=https://mirrors.aliyun.com/epel/7/\$basearch/ enabled=1 gpgcheck=0 EOF ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值