Updated: 28 September 2026 · Applies to: dnf 4.14 to 4.20 with dnf-plugins-core on AlmaLinux and Rocky Linux 9 and 10 and RHEL 9 and 10; dnf5 on Fedora
Sometimes you need RPM packages as files instead of installing them: to install them on a server without internet access, to keep exact versions, or to inspect them first. On CentOS 7 and older releases this needed the yum-downloadonly plugin or yumdownloader and repotrack from yum-utils. Today the same jobs are built into dnf; the yum-utils package still provides yumdownloader and repotrack as wrappers for old scripts. We tested the commands below on AlmaLinux 9 and 10.
Before you start
The download command comes from the dnf-plugins-core package, which is usually installed. If not: dnf install dnf-plugins-core.
Method 1: download a package and its missing dependencies
mkdir -p /root/rpms && cd /root/rpms dnf download --resolve nano
--resolve adds the dependencies that are not installed on this server. If the target server has the same packages installed as this one, this is all you need.
Method 2: download the package with every dependency
dnf download --resolve --alldeps nano
--alldeps also downloads dependencies that are already installed here. Use this for an offline server whose installed packages you do not know. For nano this is 18 files on a minimal AlmaLinux 9 system, instead of 1.
Method 3: download as if installing
dnf install --downloadonly --downloaddir=/root/rpms nano
dnf works out exactly what an install would need on this server and saves those packages without installing them.
Other useful options
- A specific version:
dnf download nano-5.6.1-7.el9 - The source package:
dnf download --source nano - Only print the download addresses:
dnf download --url nano - For another architecture:
dnf download --arch=x86_64 nano
See the dependencies first
dnf repoquery --requires --resolve nano
More ways to explore dependencies are in how to use repoquery.
Install the downloaded files on the other server
dnf install /root/rpms/*.rpm
Installing through dnf, rather than rpm -i, checks signatures and installs everything in the right order. On a server without internet access, add --disablerepo='*' so dnf does not try to reach repositories.
Official documentation: DNF download plugin.
Ucartz services for this topic
- KVM VPS hosting: NVMe SSD and full root access, with Free Basic Managed Support.
- Unmanaged dedicated servers: full root access and free IPMI KVM, with Free Basic Managed Support.
- Linux server management: hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.
