Yum Install Package – Install Without Updating Other Packages

yum

Is there a way to tell yum to install a package, selecting a version of that package that would be satisfied by currently installed dependencies?

For example, if I'm installing a pecl package and I currently have installed php-5.4.11 but a newer php-5.4.14 is available. Rather than install the new package (and update all php packages to 5.4.14) I just want it to select an older version of the package I requested to be installed without updating all the others (or fail if this cannot be done).

This is a specific case in which I know I could exclude or fix the php package but I'm looking for a generic option that would apply to any install.

Something like:

yum install php-pecl-xxxx --no-updates

Best Answer

Temporary Solution:

Use -C flag:

sudo yum install foobar -C

Permanent solution:

Use the metadata_expire flag in your yum.conf to control this.

Edit /etc/yum.conf and set

metadata_expire=15d

You can use d, h or m to configure the time in days, hours, or minutes.

Bonus: here is the documentation:

metadata_expire is Time (in seconds) after which the metadata will expire. So that if the current metadata downloaded is less than this many seconds old then yum will not update the metadata against the repository. If you find that yum is not downloading information on updates as often as you would like lower the value of this option. 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. Note that when using a metalink file the metalink must always be newer than the metadata for the repository, due to the validation, so this timeout also applies to the metalink file. Also note that "never" does not override "yum clean expire-cache"

Related Question