How to install package with yum without updating repository information

installationpackagesrepositoryyum

I want to install some packages from repository but always when I'm trying to yum install packagename yum updates db:

Loaded plugins: fastestmirror, langpacks, presto, refresh-packagekit
Determining fastest mirrors
updates/metalink                                                                                                                      |  23 kB     00:00     
 * fedora: nl.mirror.eurid.eu
 * rpmfusion-free: ftp.astral.ro
 * rpmfusion-free-updates: ftp.astral.ro
 * rpmfusion-nonfree: ftp.astral.ro
 * rpmfusion-nonfree-updates: ftp.astral.ro
 * updates: nl.mirror.eurid.eu
fedora-awesome                                                                                                                    | 3.3 kB     00:00     
google-chrome                                                                                                                     |  951 B     00:00     
rpmfusion-free-updates                                                                                                        | 3.3 kB     00:00     
rpmfusion-free-updates/primary_db                                                                                             | 272 kB     00:08     
rpmfusion-nonfree-updates                                                                                                     | 3.3 kB     00:00     
rpmfusion-nonfree-updates/primary_db                                                                                          |  93 kB     00:05     
updates                                                                                                                       | 4.7 kB     00:00     
updates/primary_db                                                                                                            | 4.6 MB     02:35     
updates/group                                                                                                                     | 1.9 MB     00:33     

So using yum install packagename -C also not works ("cache not found" error happens and yum makecache don't give results too).
But I just want to install packages without updating db.

Best Answer

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.