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?


I believe this behavior is governed by this parameter:


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).



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

$ sudo yum makecache


| improve this answer | |
  • What if he puts metadata_expire=never and uses the yum-plugin-refresh-updatesd package to check for updates or even the yum-makecache.service? The /etc/yum.conf file hints at this: > It is esp. important, to have correct metadata, for > distributions like > # Fedora which don't keep old packages around. If you > don't like this checking > # interupting your command line usage, it's much better > to have something > # manually check the metadata once an hour (yum-updatesd will do this). – ILMostro_7 Jun 17 '14 at 11:06
  • 1
    I set mirrorlist_expire and metadata_expire to a high value. This solved the problem for me. Thanks a lot – mirk Jun 17 '14 at 15:02
  • @mirk - glad that solved it, thanks for the Q. – slm Jun 17 '14 at 15:26

You can use -C flag in yum. As per YUM's man page:

-C, --cacheonly
        Tells yum to run entirely from system cache - does not 
        download or update any headers unless it has to to perform the 
        requested action.  If  you’re  using  this as a user yum will not 
        use the tempcache for the user but will only use the system cache in 
        the system cachedir.

and also please check this question

| improve this answer | |

Besides the idea of changing the metadata age, you can simply remove the configuration for the repositories which are not reachable. Yum does not need configured repositories to work properly - it can actually run with no configured repository at all. In such case, you are of course bound to only work with packages you have locally installed.

If you have more than one machine cut off from the Internet, it might make sense to create an internal mirror of the CentOS repos and point yum towards these.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.