Linux - Yum "Cannot find a valid baseurl for repo" on CentOS 4

If you encounter this error and you are using CentOS 4, it means that you need to update your yum repository url.

CentOS 4 is obsolete and they changed the repo url. The following will help you to resolve it

1. From your CentOS machine, cd /etc/yum.repos.d

2. Back up your CentOS-Base.repo to CentOS-Base.repo.bak. Then, rm CentOS-Base.repo to remove it

3. Create a new CentOS-Base.repo with vi CentOS-Base.repo

4. Paste the following to CentOS-Base.repo and save it (actually file is at http://vault.centos.org/4.9/CentOS-Base.repo)

[base]
name=CentOS-$releasever - Base
baseurl=http://vault.centos.org/4.9/os/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-centos4
protect=1
priority=1

#released updates 
[update]
name=CentOS-$releasever - Updates
baseurl=http://vault.centos.org/4.9/updates/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-centos4
protect=1
priority=1

#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
baseurl=http://vault.centos.org/4.9/addons/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-centos4
protect=1
priority=1

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://vault.centos.org/4.9/extras/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/RPM-GPG-KEY-centos4
protect=1
priority=1

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://vault.centos.org/4.9/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-centos4
protect=1
priority=2

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
baseurl=http://vault.centos.org/4.9/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/RPM-GPG-KEY-centos4
protect=1 
priority=2

Comments

Post a Comment

Popular Posts