Disable YUM mirrorlist checking

mirroryum

I have a machine which is not connected to the internet. I still want to execute some yum commands from time to time.

YUM does like to update the mirrorlist every so often, resulting in errors like:

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was' from yum-dump.py! Please check your yum configuration.

Is there a parameter in yum.conf or elsewhere to make yum stop updating the mirrorlist?

Best Answer

I believe this behavior is governed by this parameter:

metadata_expire

Duration in seconds after which the metadata will expire. So if the current metadata downloaded is some seconds younger, then yum will not update the repository metadata. If you think that yum is not downloading the update information as often as you wish, reduce the value of this parameter. You can also change the default format in seconds to days, hours or minutes adding d,h or m to the specified value. The default is 1.5 hours, for running yum-updatesd every hour. You can also use the word never meaning that the metadata will never expire.

So I'd try either a 0d, -1, or set the value to something that's really long, 1000d (1000 days).

Example

metadata_expire=99999999

You can then update the cache when you do have access to the internet:

$ sudo yum makecache

References