現象:使用yum命令安裝軟件,報如下錯誤:centos
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不存在。curl
解決辦法:this
一、首先進入 /etc/yum.repos.d 目錄,備份CentOS-Base.repo源,url
#cp CentOS-Base.repo CentOS-Base.repo.bak spa
二、修改 CentOS-Base.repo 文件3d
#vi CentOS-Base.repoxml
將http://mirrors.cloud.aliyuncs.com 批量替換爲 http://mirrors.aliyun.comblog
三、備份epel.repo源,修改epel.repo文件it
#cp epel.repo epel.repo.bak
#vi epel.repo
http://mirrors.cloud.aliyuncs.com 批量替換爲 http://mirrors.aliyun.com
四、清理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