使用yum安装服务报错:[Errno 14] curl#6 - “Could not resolve host: mirrors.cloud.aliyuncs.com; Name or service

当使用yum命令在CentOS系统中安装软件时,遇到错误`Nomoremirrorstotry.`和`Couldnotresolvetarget:...`,原因是yum源不可用。解决方案包括:备份并修改CentOS-Base.repo和epel.repo文件的源地址,将`mirrors.cloud.aliyuncs.com`替换为`mirrors.aliyun.com`,清理并重建yum缓存。如果出现GPG密钥问题,可以导入`/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7`来解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

现象:使用yum命令安装软件,报以下错误:

failure: repodata/repomd.xml from epel: [Errno 256] No more mirrors to try.
http://mirrors.cloud.aliyuncs.com/epel/6/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - “Could not resolve host: mirrors.cloud.aliyuncs.com; Name or service not known”

原因:yum 源 mirrors.cloud.aliyuncs.com不存在。

解决办法:

1、首先进入 /etc/yum.repos.d 目录,备份CentOS-Base.repo源,

#cp CentOS-Base.repo CentOS-Base.repo.bak

2、修改 CentOS-Base.repo 文件

#vi CentOS-Base.repo

将http://mirrors.cloud.aliyuncs.com 批量替换为 http://mirrors.aliyun.com

3、备份epel.repo源,修改epel.repo文件

#cp epel.repo epel.repo.bak

#vi epel.repo

http://mirrors.cloud.aliyuncs.com 批量替换为 http://mirrors.aliyun.com

4、清理yum缓存和重新生成缓存,

#yum clean all

#yum makecache

之后继续yum就正常了。

如yum安装时,还报以下错误:

warning: /var/cache/yum/x86_64/7/base/packages/httpd-tools-2.4.6-88.el7.centos.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Retrieving key from http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6

The GPG keys listed for the “CentOS-7 - Base” repository are already installed but they are not correct for this package.

Check that the correct key URLs are configured for this repository.

解决办法:

执行:#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

转载于:https://www.cnblogs.com/cxq20190307/p/10700340.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值