First, We will try to install the Epel repository by using the same method. if this does not work, Now follow the below step to troubleshoot Cannot Retrieve Metalink for the repository.
This happens when your machine is not able to fetch or make a connection to Epel Repository.
Step 1: We have to install the Epel repository using the below command.
yum install epel-release -y yum repolist
Check Out: Enable EPEL Release Repository
Step 2: So you need to check if there are these two files Epel.repo & epel-testing.repo available or not in /etc/yum.repos.d
Solution 1: There are Both files, You just need to edit these files one by one & uncomment the baseurl line and comment on the Metalink line. There can be mirrolist instead of Metalink.
vim epel.repo vim epel.repo
Check Out: GET Command Not Found
You need to do this in both files epel.repo and epel-testing.repo then run the following commands
yum clean all yum repolist
Now You will see epel-repo
Solution 2: You may need to update your certificate
yum –disablerepo=epel -y update ca-certificates
Note: You can also change https to HTTP of mirrorlist URL in Epel-repo.
Check Out: Install Memcached
Solution 3: If the above solution does not work for you. Try this
rpm --rebuilddb yum clean all && yum makecache fast && rm -rf /var/cache/yum
YouTube Link: Epel-Repo Error