Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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
share|improve this question

4 Answers 4

up vote 2 down vote accepted

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


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"

share|improve this answer

Have not come across any such option as of now. However if u want to install the package without upgrading I would recommend downloading a rpm of same version and then install it.

share|improve this answer

In the yum-utils package there is a tool called yumdownloader. You can use it to download from repos without installing. All the standard switches like --disablerepo apply. See the man page for more into on it.

I think you can download the RPM and then do what you want using RPM directly.

share|improve this answer
This is a part of an automatic package installation system, the problem is that we don't want yum to 'install the latest' and 'update everything that's needed'. We really just want it to install a version of the package that is compatible with what's already installed. Basically an installonly or install xxx -no-updates option. –  Clint Priest May 2 '13 at 16:32

If the older version of the package is still in your yum repositories, then you can just run yum install packagename-version-release.arch and it'll install the older version without trying to upgrade to the latest release. You'll need to use the full name, version, release and arch if there are multiple versions and architectures in your yum repo. You can get all that information by running yum list available 'packagename*' to search for all packages starting with 'packagename'. If you've managed to upgrade your packages and want to downgrade to the older release, you can run yum downgrade packagename1 packagename2. You'll need to include the list of all the packages you want to downgrade, since it probably will involve a lot of dependencies.

If the older release isn't in your yum repository, then just download it from wherever you found the old package and install it with yum install /path/to/package.rpm, although I would caution against installing packages from untrusted sources.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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