centos yum 执行报Cannot retrieve metalink for repository: epel. Please verify its path and try again

今天搭建服务器环境的时候, 发现yum执行 会报以下错误

...
Cannot retrieve metalink for repository: epel. Please verify its path and try again

经过资料查看,可以通过以下方法解决

vim /etc/yum.repos.d/epel.repo

将该文件第三行注释取消, 第四行添加注释:
原:

#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch

修改为

baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch

修改完成后, 执行
yum clean
之后便可以正常使用

你可能感兴趣的:(centos yum 执行报Cannot retrieve metalink for repository: epel. Please verify its path and try again)