Sed oneliner to change Centos 4 repos to vault.centos.org


Centos 4 is now EOLed. You should upgrade or remove your 4.x server from production. Since EOL all repositories have been moved to vault.centos.org. Yum is not working any more because of that. Here is my quick and dirty solution.

sed "s/\/mirror\.centos\.org\/centos/\/vault\.centos\.org/g;\
s/^#baseurl/baseurl/g;\
s/^mirrorlist/#mirrorlist/g;\
s/\$releasever/4\.9/g" /etc/yum.repos.d/CentOS-Base.repo -i.bak

sed "s/\/mirror\.centos\.org\/centos/\/vault\.centos\.org/g;\
s/^#baseurl/baseurl/g;\
s/^mirrorlist/#mirrorlist/g;\
s/\$releasever/4\.9/g" /etc/yum.repos.d/CentOS-fasttrack.repo -i.bak
centos  sed