Download all dependencies with yumdownloader, even if already installed?
You can use repotrack
instead like this:
repotrack -a x86_64 -p /repos/Packages [packages]
Unfortunately there is a bug with the -a
flag (arch). It will download i686 and x86_64.
Here's how to fix it:
if opts.arch:
#archlist = []
#archlist.extend(rpmUtils.arch.getArchList(opts.arch))
archlist = opts.arch.split(',') # Change to this
else:
archlist = rpmUtils.arch.getArchList()
You can use repoquery
to get a list of group packages:
repoquery --qf=%{name} -g --list --grouppkgs=all [groups]
Which you can feed into repotrack:
repoquery --qf=%{name} -g --list --grouppkgs=all [groups] | xargs repotrack -a x86_64 -p /repos/Packages
For everyone's information, yumdownloader
does not do the job. For anyone with some experience in package management with `yum, it is natural to expect that the following command-line would recursively download a package RPM and all its dependencies:
yumdownloader --resolve <package>
But it does not. May be it prints first-level dependencies or those that are not already installed. I am not sure.
Here is one method that works on CentOS 6.5. Follow the steps to install the downloadonly plugin for yum
as given by Red Hat. Basically, on CentOS 6.x, do:
$ sudo yum install yum-plugin-downloadonly.noarch
Then make use of the plugin in combination with the --installroot
switch of yum
. This prevents yum
from resolving and then skipping dependencies that are already installed on the system.
sudo yum install \
--installroot=</path/to/tmp_dir> \
--downloadonly --downloaddir <rpm_dir> <package>
You would downloaded RPMs of the package, <package>
and all its dependencies in the directory, <rpm_dir>
. Example, with Git:
$ mkdir root rpms
$ sudo yum install --installroot=/home/roy/root \
--downloadonly --downloaddir rpms/ git
Also try
repoquery -R --resolve --recursive <name> | xargs -r yumdownloader
e.g.:
repoquery -R --resolve --recursive firefox | xargs -r yumdownloader
Source: https://www.thegeekdiary.com/downloading-rpm-packages-with-dependencies-yumdownloader-vs-yum-downloadonly-vs-repoquery/