Hello folks…
Today I was trying to install a package on an old CentOS 6 server and got the below error.
Loaded plugins: fastestmirror, presto, security Setting up Install 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
Issue
The root cause of this error is, the CentOS 6 is already the end of life (November 30th, 2020) and the repositories are deprecated.
Resolution
The resolution for the issue is to remove the old mirror and baseurl link for the CentOS repos and replace it with the CentOS vualt link.
- Backup the old CentOS-Base.repo file
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo-old
- Create a new CentOS-Base.repo with the below contents
vim /etc/yum.repos.d/CentOS-Base.repo
- Add the below lines, and save and exit.
[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 [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
- Then run the below commands to clean and refresh the repo files
yum clean all yum repolist
- Now you will be able to install the packages.
Thanks, it works like a charm
wordk perfect