This tutorial will explain how to fix yum repo error “Cannot find valid baseurl”, while executing
yum install or
yum update commands on CentOS version 5.11. Here’s the snapshot of the complete error.
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
How to solve YumRepo error – Cannot find valid baseurl?
Red Hat Enterprise Linux 5 (RHEL 5) and its derivatives such as CentOS 5 and Scientific Linux 5 have reached their end-of-life (EOL) at the end of March 2017. All the systems should be updated to the releases of RHEL 6/CentOS 6 or RHEL 7/CentOS 7 which are supported until 2020 and 2024 respectively as stated here.
If you still want to run CentOS 5 for various reasons, then you should take care of security issues. Since CentOS 5 is stopped, many mirror sites are dropping CentOS-5 repositories. In case, if you ever want to access yum repos for the older version of RHEL or CentOS then follow the below steps.
Step 1: Run the below commands as root/sudo privileged user.
# echo "http://vault.centos.org/5.11/os/x86_64/" > /var/cache/yum/base/mirrorlist.txt
# echo "http://vault.centos.org/5.11/extras/x86_64/" > /var/cache/yum/extras/mirrorlist.txt
# echo "http://vault.centos.org/5.11/updates/x86_64/" > /var/cache/yum/updates/mirrorlist.txt
Well, you just got the CentOS 5 repository ready. Now you can install or upgrade the package from the vault.centos.org repository.
Step 2: Run the yum update command:
# yum update