Table of Contents
# cat /etc/centos-release
CentOS release 6.10 (Final)
In some cases, when trying update CentOS 6 with yum update command getting error:
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Update Process
Determining fastest mirrors
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 find a valid baseurl for repo: base
Cause
CentOS 6 reached end of life on the 30th of November 2020. YUM attempting connect to deprecated repositories. So, we need update deprecated repositories URL’s and point to the vault.
Resolution
To fix this problem you edit /etc/yum.repos.d/CentOS-Base.repo and replace all mirrorlist.
1. Navigate to this folder /etc/yum.repos.d then create a backup of original file.
cd /etc/yum.repos.d/
cp CentOS-Base.repo CentOS-Base.repo.old
# ls -l /etc/yum.repos.d/
-rw-r--r--. 1 root root 1059 Oct 30 14:54 CentOS-Base.repo
-rw-r--r--. 1 root root 1991 Oct 30 14:52 CentOS-Base.repo.old
-rw-r--r--. 1 root root 647 Jun 26 2018 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 289 Jun 26 2018 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 Jun 26 2018 CentOS-Media.repo
-rw-r--r--. 1 root root 8854 Jun 26 2018 CentOS-Vault.repo
2. Delete the file CentOS-Base.repo then recreate that file with any text editor.
rm -rf CentOS-Base.repo
vi CentOS-Base.repo
3. Copy and paste all below lines into the file then save the file.
[base]
name=CentOS-$releasever - Base
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
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
baseurl=https://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
4. Clean yum cache then run update again.
yum clean all
yum update -y
Now you can successfully update your CentOS 6.
# yum history
Loaded plugins: fastestmirror
ID | Login user | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
2 | root <root> | 2022-10-30 14:57 | I, U | 37
1 | System <unset> | 2022-10-30 14:30 | Install | 205
ADVERTISEMENT
5/5 - (1 vote)