Download RPM Package Using DNF without Installing it

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.

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


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 is a certified LPIC Linux administrator and passionate Linux technical writer. He has over 4 years of penning down technical guides in Linux administration with ample experience in a range of distributions such as Ubuntu, CentOS, RHEL, Fedora, Rocky, and AlmaLinux to mention a few. In addition, he has also spread his wings wider to cloud computing and DevOps tools such as Terraform, Docker, and Kubernetes. During his free time, I love swimming, listening to music, reading books, and taking evening runs after a busy day.



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

Comments Off on How to Articles