When you try to install any package, yum gives error “cannot retrieve metalink for repository”. This error is encountered when you don’t have internet access or if proxy is not configured for your yum repository.
Fix: Cannot retrieve metalink for repository
Make the proxy entry in your /etc/yum.conf
# vi /etc/yum.conf
proxy=http://ip:port
Or you can export the proxy details with the export command
# export HTTP_PROXY=http://proxy-ip:port
Then run
# yum clean all
# yum repolist
When you do yum repolist , it will show you all the repositories enabled in your yum.
Note: Make sure you dont have duplicate naming for your repositories available in /etc/yum.repos.d directory.