When you installed EPEL Repository on CentOS, you use “yum” to install some application but the issue appears (Cannot retrieve metalink for repository: epel) :
# yum install mysql-server Loaded plugins: fastestmirror Determining fastest mirrors Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
Reason:
– Default in EPEL Repo is configured to connect to EPEL Server by HTTPS Connection, however in some cases the information Certificate Chain/Root Certificate on CentOS doesnt have good-new Certificates so you cannot connect to EPEL Server for retrieving metalink.
Contents
Fix error “Cannot retrieve metalink for repository: epel” on CentOS
Method 1: update ca-certificates
– You need to update your ca-certificates on CentOS.
# yum clean all # yum --disablerepo=epel reinstall ca-certificates -y # yum --disablerepo=epel update ca-certificate -y
– Then retry to use “yum” command to operate what you want.
Method 2: change the way “yum” will connect to EPEL Repo
– You need to change the method “yum” will connect to EPEL to retrive data, change from “https” -> “http” in file configuration of EPEL “epel.repo“.
# sed -i "s/mirrorlist=https/mirrorlist=http/" /etc/yum.repos.d/epel.repo
– Do edit manually file ‘epel.repo’ with changing the value ‘mirrorlist=https‘ -> ‘mirrorlist=http‘.
# vi /etc/yum.repos.d/epel.repo mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
to
mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
– Then retry to use “yum” command to operate what you want.
Above is two basic way to fix error “Cannot retrieve metalink for repository: epel” on CentOS