yum安装时出现:Cannot retrieve metalink for repository: epel. Please verify its path and try again

错误描述

在CentOS 6 下使用yum的时候出现了问题:Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

解决方法

把/etc/yum.repos.d/epel.repo,文件第3行注释去掉,把第四行注释掉。具体如下:

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

[epel]

name=Extra Packages for Enterprise Linux 6 - $basearch

#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch

mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch

修改为

[epel]

name=Extra Packages for Enterprise Linux 6 - $basearch

baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch

#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch

再清理一下源

yum clean all
yum update