Download RPM Package Using DNF without Installing it

Written by: James Kiarie   |   Last updated: July 12, 2022

We can use package managers to download only rpm packages(offline) without installing them with all dependencies on Linux.

You can use downloaded rpm to install the package on another system that doesn't have internet. Also in scenarios where you used curl or wget to download a package but the required dependencies missing. Then also this comes to help.

DNF package manager is used in RedHat-based distributions such as RHEL, CentOS, and Fedora, mostly for installation, reinstallation, update, upgrade, and removal of rpm packages.

In this guide, we learn how to download RPM using DNF without installing it.

Downloading RPM using dnf

On Fedora 22 and later, yum is deprecated and in its place is the dnf package manager.

To download a package using dnf, use the following syntax:

dnf download package-name

To enhance DNF with download, this will install core plugins. List installed packages to check if its already installed.

dnf install dnf-plugins-core

For example to download the samba package, type:

dnf download samba
dnf download rpm
dnf download rpm

To download the dependencies, append the --resolve flag

dnf download samba --resolve
dnf download only with dependencies
dnf download only with dependencies

Check the presence of downloaded dependencies using the ls command.

ls
List downloaded all rpm files
List downloaded all rpm files

You can then install those rpm packages using the rpm command.

For example:

rpm -ivh *.rpm

Conclusion

Generally, the best and easiest way of installing packages is by using the yum install package-name or dnf install package-name commands. If you prefer downloading a package first and installing it later, ensure you download the dependencies as well using the --resolve flag and install all of them simultaneously to avoid getting dependencies errors.

About The Author

James Kiarie

James Kiarie

James Kiarie is a skilled and certified LPIC Linux administrator with a strong passion for technical writing, specializing in the Linux domain. With over four years of experience, he has crafted numerous technical guides, helping a wide audience navigate through various Linux distributions.

SHARE

Comments

Please add comments below to provide the author your ideas, appreciation and feedback.

2 Comments

2 thoughts on “Download RPM Package Using DNF without Installing it”

  1. I wonder why the manpage in the latest Fedora Workstation (release 38) left out the ‘download’ command, leading me to seek pages helping me with –downloadonly and –downloaddir=’…’. They didn’t mention a download option either.

    An oversight by the dnf authors? I think not. Having mounted the live image and finding (after several mounts to get at the actual live files) there are no rpms, it was a copy of the live image saying ‘oh yeah, and this RPM is here too’. I can accept that, but I cannot accept the lack of accurate, truthful and complete documentation.

    Meanwhile, This is not the place to scream about why more(1) has been altered from it’s native form. I was teethed on 4.2bsd and know more(1) exits when it hits EOF. WHY ARE THEY MUCKING WITH IT! If you don’t like more(1) – Use less(1)! Make an alias but don’t screw around with the defaults of an existing command!!! Now I need an alias for what was the norm, make more(1) exit when it hits EOF. Next I know cd(1) will be asking if I really want to alter my current working directory folder. ARRRRRGGGGGHHHH!

    not an lol

    Reply

Leave a Comment