When trying to update or install packages on older CentOS 5 systems, you may run into the following error.
root@server1 [~]# yum update -y Loaded plugins: fastestmirror Determining fastest mirrors YumRepo Error: All mirror URLs are not using ftp, http[s] or file. Eg. Invalid release/ removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt Error: Cannot find a valid baseurl for repo: base
This is commonly caused by attempting to use deprecated repositories. The update repositories were moved to the CentOS vault when the operating reached it's end-of-life.
In order to continue using the operating system packages, you will need to update your repository entries to point to the vault.
Using your favorite text editor, open /etc/yum.repos.d/CentOS-Base.repo
Look for the following:
[base] name=CentOS-$releasever - Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
Comment out the mirror list, and uncomment the baseurl. So it should look like the following:
Next, you will need to put in the URL for the vault repository.
for 32-bit systems, use: http://vault.centos.org/5.11/os/i386/
for 64-bit systems, use: http://vault.centos.org/5.11/os/x86_64/
Once you have added this, run the following to clean your yum cache:
yum clean all
Then update yum to start using the new repositories: