CentOS “yum update” URL not found 404

This happens when CentOS do a major version release like from 6 to 7. It doesn’t happen immediately but after the new major version has been released for a while they’ll update repository URL from major.minor (e.g. 6.5) version to just a major (6).

So it changes from something like “http://mirror.centos.org/centos/6.5/os/x86_64/” to “http://mirror.centos.org/centos/6/os/x86_64/”.

When you run “yum update” it looks at variable $releasever in /etc/yum.repos.d/CentOS-Base.repo file. But that variable would parse out to value “6.5”. All you need to go is replace $releasever to “6”.

cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bkup
sed -ie "s/\$releasever/6/g" /etc/yum.repos.d/CentOS-Base.repo

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.