rpmyum

How to download a RPM package, and his dependencies as a normal user (not root)


I can download a package and his dependencies using the following command:

yum install --downloadonly --downloaddir=/tmp/RPMs PACKAGE

But this command requires superuser privileges.

This is counterintuitive as I'm only downloading files, not installing anything. But I guess the command check privileges before running the plugin. Is there another command which would achieve the same result without the superuser privileges ?

The command yum download exists, but it doesn't fetch dependencies like the above command does, and I didn't find any option to do so in the man page.

For the context, I'm trying to install a package and his dependencies in a Docker image, which doesn't have the required certificates to download anything. So the idea is to download the packages from the machine building the Docker image, and copy them into the Docker image. But it's unthinkable to require superuser privileges to build the project...


Solution

  • I think the Unix & Linux stackexchange is more suited for this kind of questions. Please next time ask there.

    repotrack --arch=x86_64 --download_path=<path where you want to download the files>
    

    For more information you can check the man pages of repotrack.

    The package is part of yum-utils.

    Edit:

    This is counterintuitive as I'm only downloading files, not installing anything. But I guess the command check privileges before running the plugin. Is there another command which would achieve the same result without the superuser privileges ?

    The reason why you can't download the packages via

    yum install --downloadonly --downloaddir=/tmp/RPMs PACKAGE
    

    is that even that the operation itself is non-privileged operation you need to access the certificates that are protected against non-privileged access.