I'd like to install a package named pA.

  • Package pA-1.0.0-0 depends on package pB-1.0.0-0.
  • On a yum repository, one can find both pB-1.0.0-0 and pB-1.1.0-0.
  • Package pA-1.0.0-0 is not compatible with pB-1.1.0-0, and this information is not mentioned in the RPM of pA because pB-1.1.0-0 did not exist back when pA was packaged.

This is a problem when trying to install pA with yum:

$ yum localinstall pA-1.0.0-0.el7.x86_64.rpm
Resolving Dependencies
-> Processing Dependency: pB >= 1.0.0 for package: pA-1.0.0-0.el7.x86_64
--> Package pB.x86_64 0:1.1.0-0.el7 will be installed # <-- version 1.1! ho no!

Is there a command line option in yum to ask it to install the specific version demanded for its dependencies?
Specifically here, to install pA-1.0.0-0.el7.x86_64 rather than pA-1.1.0-0.el7.x86_64.

Note: I cannot deal with pA's dependencies by hand: in my real scenario, there is countless dependencies I wouldn't install separately with rpm.

  • Additional question: What would happen if pB-1.1.0-0 was versionned pB-2.0.0-0 instead? – YSC Jun 11 '18 at 11:38
  • AFAIK You don't manage dependancies directly with options in yum. As you already said dependancies are managed from the .spec file used to build an RPM package. You can modify the spec file for existing packages with rpmrebuild though – HBruijn Jun 11 '18 at 11:55

There's no way to do directly what you're asking, but you can install a specific version of the dependency before installing your primary package:

yum install pB-1.0.0-0
yum install pA

To prevent pB from being upgraded when updating the rest of the system, you can use the versionlock plugin for yum:

yum install yum-plugin-versionlock
yum versionlock pB-*

This will lock the version of pB at whatever was installed when the lock was put in place. See How to restrict yum to install or upgrade a package to a fixed specific package version?

Edit: If you don't want to/can't deal with manual installation of the dependencies in their required versions, you can add the list of deps and their versions to /etc/yum/pluginconf.d/versionlock.list to ensure specific versions get installed when you install pA.

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.