Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: "Error: Cannot find a valid baseurl for repo: extras" in Centos 5  (Read 3453 times)

0 Members and 1 Guest are viewing this topic.

nandulalr

  • Guest
When trying to update or install packages on older CentOS 5 systems, you may run into the following error.
Code: [Select]
# 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 its 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.
To resove the issue, kindly follow the below steps:

1. Take a backup of the CentOS-Base.repo.
Code: [Select]
cp -p /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup1

2. Rename /etc/yum.repos.d/CentOS-Base.repo.
Code: [Select]
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup2

2. Create new file /etc/yum.repos.d/CentOS-Base.repo.
Code: [Select]
vim /etc/yum.repos.d/CentOS-Base.repo

3. Copy and paste the below contents into the new /etc/yum.repos.d/CentOS-Base.repo file.
Code: [Select]
[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/
baseurl=http://vault.centos.org/5.11/os/i386/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

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

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

4. Once you have added this, run the following to clean your yum cache:
Code: [Select]
yum clean all

5. Then update yum to start using the new repositories:
Code: [Select]
yum update