Skip to main content

How to Disable the CentOS Mirror List for Package Downloads

What

CentOS has reached end of line on June 30, 2024. This will cause issues when attempting to download install packages from repositories. The CentOS mirror list feature allows yum, the package manager, to find and use the nearest and fastest mirror automatically. However, there can be circumstances where disabling this feature is necessary, such as:

Mirror Issues: Sometimes, specific mirrors can be slow, outdated, or unreliable, causing issues with package installations and updates.

When/Why

Mirrorlist.centos.org no longer exists anymore and you will need to update the repo files. On your server, CentOS, locate the repo file and update with following below.

How

From the .repo file:

# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.

To resolve the issue, you can mass update all .repo files with:

sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo