How to install package with yum without updating repository information?

If you want yum to behave like apt-get (not to update the metadata by each run), edit /etc/yum.conf and put there:

metadata_expire=never

or

metadata_expire=7d

in case you want to update the metadata after a week. If you run yum makecache, your metadata will be updated like by apt-get update in Debian.

But keep in mind that if you use "never" in the config file, you will have to care about that manually. If you use i.e. "7d", you will save your data bandwidth, but after a week, the metadata will be updated for you automatically.

Here is the metadata_expire documentation:

You can also change from the default of using seconds to using days, hours or minutes by appending a d, h or m respectively. The default is 6 hours, to compliment yum-updatesd running once an hour. It's also possible to use the word "never", meaning that the metadata will never expire.


What you're asking is out of the spirit of yum in some regards. Yum is a comprehensive package and dependency manager. In order to do it's job and not screw up your system by mix-and-matching incompatible packages, it needs to have that data you don't want to update.

You can manually analyze what dependencies a package has by using deplist <packagename> and install them manually.

Not having yum have an up-to-date seems like an odd request whatever the circumstances...


If you want to install a package without updating the db, you download the rpm directly (either via yumdownloader, ftp or web browser) and then install it with the rpm directly:

rpm -ivh packagename

I do not recommend you do this, as it is a lot more work to track down the dependencies (that is why yum is created) and it could break future installs via yum.