Fix yum after CentOS 7 end of life Print

  • 1

CentOS 7 is now end of life and they have disabled the repo meaning "yum" is no longer usable.

Errors such as the below when using the "yum" command are a sign of this:

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Name or service not known"
14: curl#6 - "Failed to resolve host: mirrorlist.centos.org; Unknown error"
Cannot find a valid baseurl for repo: base/7/x86_64

Run the following two commands then yum will be usable again:

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*


Was this answer helpful?

« Back