Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Cannot find a valid baseurl for repo: base [closed]

I need some help please, I am trying to install yum update in CentOS 5.9 but I get error

> Loaded plugins: fastestmirror, kmod Loading mirror speeds from cached
> hostfile 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

please help me how to fix this

update content of CentOS-Base.repo

   [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
exclude=redhat-logos php53*

#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
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
exclude=redhat-logos php53*

#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/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
exclude=redhat-logos php53*

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
exclude=redhat-logos php53*

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=5$releasever&arch=$basearch&repo=contrib
baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
exclude=redhat-logos php53*

Thank you in advance.

like image 265
jemz Avatar asked Dec 14 '22 23:12

jemz


2 Answers

This is because Centos 5 is deprecated and requires manual update of the Base repo file to point everything to the Centos vault.

Source: http://realtechtalk.com/Centos_59_Working_Vault_Repo_file-1921-articles

Backup your /etc/yum.repos.d/Centos-Base.repo

Replace with the following will get you going again:

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-5.9 - Base
#mirrorlist=http://mirrorlist.centos.org/?release=5.9&arch=$basearch&repo=os
baseurl=http://vault.centos.org/5.9/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

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

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

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5.9 - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=5.9&arch=$basearch&repo=centosplus
baseurl=http://vault.centos.org/5.9/os/$basearch/centosplus/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users
[contrib]
name=CentOS-5.9 - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=5.9&arch=$basearch&repo=contrib
baseurl=http://vault.centos.org/5.9/os/$basearch/contrib/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
like image 149
Areeb Soo Yasir Avatar answered Jan 29 '23 10:01

Areeb Soo Yasir


This might be caused by two possibilities.

1. Repo too old to find

Base on your centos version, I tried to find the os via the link. And getting this information from readme file.

This directory (and version of CentOS) is deprecated. For normal users, you should use /5/ and not /5.9/ in your path. Please see this FAQ concerning the CentOS release scheme:

https://wiki.centos.org/FAQ/General

If you know what you are doing, and absolutely want to remain at the 5.9 level, go to http://vault.centos.org/ for packages. Please keep in mind that 5.9 no longer gets any updates

In this link, it suggest you to find old version via another link. Thus, you need to modify CentOS-Base.repo.

Replacing all http://mirror.centos.org/centos/*** into http://vault.centos.org/***.

for example:

Original: baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
New:      baseurl=http://vault.centos.org/$releasever/os/$basearch/

2. Network Issue

checking the mirrorlist server is accessible.

$ ping mirrorlist.centos.org

If you might meet the error message below.

ping: unknown host mirrorlist.centos.org

To solve this, adding a valid nameserver into resolv.conf (use sudo if you are not root user)

$ echo nameserver 8.8.8.8 > /etc/resolv.conf
like image 34
Kir Chou Avatar answered Jan 29 '23 10:01

Kir Chou