Notes to self

Download RPM packages locally with DNF

Sometimes, you only want to download RPM packages without installing them. This is now super easy with DNF.

If you remember Yum, you had to resolve to installing a yum-plugin-downloadonly plugin or a separate tool to be able to download them for inspection.

With DNF on the latest Fedora and CentOS 8, you can just run dnf download:

$ sudo dnf download ruby
(1/2): ruby-2.7.2-135.fc32.i686.rpm             133 kB/s |  41 kB     00:00
(2/2): ruby-2.7.2-135.fc32.x86_64.rpm           133 kB/s |  40 kB     00:00

As you can see, I am not specifying the architecture, so I got both. They were downloaded to the current working directory, which is also convenient.

There is also dnf download --resolve which pulls dependent packages as well:

$ sudo dnf download --resolve ruby
(1/6): gdbm-libs-1.18.1-3.fc32.i686.rpm         171 kB/s |  57 kB     00:00
(2/6): ruby-2.7.2-135.fc32.x86_64.rpm            73 kB/s |  40 kB     00:00
(3/6): ruby-2.7.2-135.fc32.i686.rpm              72 kB/s |  41 kB     00:00
(4/6): readline-8.0-4.fc32.i686.rpm             449 kB/s | 210 kB     00:00
(5/6): ruby-libs-2.7.2-135.fc32.x86_64.rpm      300 kB/s | 3.2 MB     00:10
(6/6): ruby-libs-2.7.2-135.fc32.i686.rpm        267 kB/s | 3.3 MB     00:12
Check out my book
Deployment from Scratch is unique Linux book about web application deployment. Learn how deployment works from the first principles rather than YAML files of a specific tool.
by Josef Strzibny
RSS