Quickly enable/disable baseurl in yum repo files

Sunday, July 22, 2012

Sometimes yum barfs issues such as

Failure: Cannot retrieve metalink for repository: fedora. Please verify its path and try again

I’ve found that this can happen if an install is particularly out of date and needs updating, among other things.

A handy “fix” is to quickly switch out the mirrorlist parameter in the *.repo configuration file, and enable the baseurl parameter. This quick sed should fix you up pretty quickly:

sed -i ‘s/#baseurl/baseurl/g’ /etc/yum.repos.d/*.repo ; sed -i ‘s/mirrorlist/#mirrorlist/g’ /etc/yum.repos.d/*repo

In order to revert the changes (when you’re updated or the mirrorlists are back online..

sed -i ‘s/baseurl/#baseurl/g’ /etc/yum.repos.d/*.repo ; sed -i ‘s/#mirrorlist/mirrorlist/g’ /etc/yum.repos.d/*repo

One Comment

  1. Hicham says:

    Vive dcr226

Leave a Reply