Fix error EPEL Repo “Cannot retrieve metalink for repository” on CentOS

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.

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

Previous articleHow to change hostname on CentOS/Ubuntu
Next articleDVWA là gì ? Damn Vulnerable Web Application là gì ?
Bạn đang theo dõi website "https://cuongquach.com/" nơi lưu trữ những kiến thức tổng hợp và chia sẻ cá nhân về Quản Trị Hệ Thống Dịch Vụ & Mạng, được xây dựng lại dưới nền tảng kinh nghiệm của bản thân mình, Quách Chí Cường. Hy vọng bạn sẽ thích nơi này !