Download RPMs for all dependencies for package using yum

centosyum

I'm attempting to create a local yum repo on my system containing various packages from, chiefly, the CentOS base repos. The server which is hosting the yum repo will not necessarily have the same base packages installed by default as the servers which will be using the yum repo. For this reason, I need to ensure that my repos contain the packages that I want and every single one of their dependencies.

I'm creating my repos using the yumdownloader tool provided in the yum-utils package to try to download an RPM file for a package using yum from the standard CentOS mirrors. Helpfully it provides a command line option, –resolve, which also downloads dependencies. However, because it's built on yum itself, yumdownloader will only download dependencies for the package that are not already present on the system.

For example, I wish to download package A, which depends on Packages B, C and D. If package D is already installed on the system, yumdownloader --resolve A will only download A, B and C, but not D.

Is there a way to download the RPMs for all dependencies on a package from a yum repo?

Best Answer

There's this bash script, which the maintainer of rpm has kindly shared with me, and I put on github. Hope you find it useful!

You can also read the original SO question, where the issue was discussed.

The script works on Fedora 23+ as it uses dnf's download plugin. It's probably very easy to make it work on Fedora 22-, as yum surely has got a similar plugin.

Additionaly, it's valuable since repotrack does not work on fedora 23 (at least it doesn't work for me).

Related Topic