CentOS 7 “Could not retrieve mirrorlist” Fix – Solution for continued support after EOL

Symptoms:

CentOS 7 system wont update or install programs via YUM commands YUM install, YUM update, YUM upgrade result in errors.

CentOS 7 EOL - Could not retrieve mirrorlist
Could not resolve host: mirrorlist.centos.org

Error: `Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=genclo error was
curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"`

CentOS 7 ELS install failed

Environment:

  • CentOS 7
  • CentOS 7 ELS

Cause:

Since 1 July 2024 Centos 7 has reached EOL (end of life) i.e. mirrorlist.centos.org doesn’t exist anymore.

Solution:

To resolve the issue you need to update all .repo files:

sed -i -e '/^mirrorlist/d;/^#baseurl=/{s,^#,,;s,/mirror,/vault,;}' /etc/yum.repos.d/CentOS*.repo

yum clean all

yum makecache

This allows the system to update and install programs normally.

About the author: Amro Sahli

You must be logged in to post a comment.