Fixing Update Issues in CentOS 6

As you might know by now - CentOS 6 is now End-of-Life (EOL) as of on November 2020, which means no more security patches and bug fixes.

If you have missed to update and no longer able to update to the last release of the update. Following is a Patch to fix and update the System.

Error you get when trying to update:

[root@vps ~]# yum update
Loaded plugins: fastestmirror, security
Setting up Update Process
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

If that is the case, then below patch is for you.

Let's take a backup of the base repo before proceeding.

cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/bakup-CentOS-Base.repo

Next we will update the Base Repo file,

Edit the file using your favourite editor.

echo > /etc/yum.repos.d/CentOS-Base.repo
vi /etc/yum.repos.d/CentOS-Base.repo

Copy and paste the below contents to the file,

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=https://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=https://vault.centos.org/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=https://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Save and Exit.

We will clean up the YUM and then try updating the system.

yum clean all
yum makecache
yum update

Once all the updates are installed, perform a reboot.

reboot

And that should fix the update issues in CentOS 6.