Can yum tell me which of my repositories provide a particular package?

Brian Deacon picture Brian Deacon · Mar 11, 2009 · Viewed 53.6k times · Source

Hopefully short version of the question: If I'm on a machine that has a particular package installed, is there a yum command that will tell me which of it's configured repositories provided that package? (Or alternately, what repository would provide a yet-to-be-installed package.)

Background in case some context is needed: We have a maze of yum repositories that we draw from. I have a machine that has a particular rpm package installed, and another machine with an apparently insufficient maze of repositories configured, and so I am not able to install the package I want onto that machine. I need to add the minimal necessary repositories to the new machine. I can't just shotgun the repositories from one machine to the other. And just going out and grabbing the rpm isn't an option because I need this to be reproducible.

Answer

janneb picture janneb · Mar 11, 2009
yum list packagename

That will show from which repository the package is in the third column of the output.

For already installed packages, that won't work, as the third column shows just "installed". In that case you can do e.g. "rpm -qi packagename", typically the Vendor, Packager and Build Host tags will give an indication to which repository the package belongs. Also it's quite common for some repo symbol being appended to the package version number.