dnf-download
Download RPM packages without installing
TLDR
Download the latest version of a package to the current directory
Download a package to a specific directory (the directory must exist)
Print the URL where the RPM package can be downloaded from
SYNOPSIS
dnf download [options] <package-specifier>...
PARAMETERS
<package-specifier>
One or more package names, globs, file paths, or provide-specifiers (e.g., 'httpd', 'kernel*', '/usr/bin/bash', 'systemd').
-x <DIR>, --downloaddir=<DIR>
Specify the directory where downloaded packages will be saved. If not provided, DNF typically uses a temporary directory or the current working directory, depending on the DNF version and configuration.
--destdir=<DIR>
An alias for --downloaddir.
--resolve
Download all package dependencies in addition to the specified packages. This is crucial for creating complete sets of packages for offline use.
--source
Download the source RPM (SRPM) files instead of the binary RPMs. Useful for reviewing source code or rebuilding packages.
--urls, --urlsonly
Instead of downloading files, print the URLs of the packages that would be downloaded to standard output. Useful for scripting or manual downloads.
--nogpgcheck
Disable GPG signature checking for all packages. Use with caution as it bypasses an important security measure.
--skip-broken
Attempt to continue with transactions even if some packages are problematic or would cause dependency issues.
-y, --assumeyes
Automatically answer yes for all questions asked by DNF, bypassing interactive prompts.
--repoid=<REPONAME>
Specify one or more repository IDs to include or exclude during the download operation. Can be used multiple times.
--arch=<ARCH>
Specify the architecture for which to download packages (e.g., 'x86_64', 'aarch64').
DESCRIPTION
The dnf download command is a powerful utility within the DNF package manager ecosystem, designed to fetch RPM packages and their associated dependencies without performing an actual installation. Unlike a standard dnf install command, which downloads and then immediately installs packages, dnf download focuses solely on the acquisition of the package files. This makes it invaluable for various scenarios such as preparing for offline installations, creating local mirror repositories, auditing package contents before deployment, or transferring specific packages to environments without direct internet access.
It supports sophisticated dependency resolution, ensuring that all required packages for a target application are retrieved. Users can specify a download directory, choose to download source RPMs, or even opt to only list the download URLs. By separating the download and installation phases, dnf download provides greater control and flexibility in managing software packages on Linux systems, particularly those using RPM-based distributions like Fedora, RHEL, CentOS, and their derivatives.
CAVEATS
While dnf download is highly useful, it's important to note that it does not perform any installation or configuration of the downloaded packages. Users must manually install them using rpm -i or dnf install later. Additionally, using --nogpgcheck can expose your system to untrusted packages, and should only be used if the source's integrity is guaranteed through other means. The command requires sufficient disk space for all specified packages and their dependencies, which can be substantial.
USAGE SCENARIOS
dnf download is ideal for creating offline installation media, populating local repositories for air-gapped networks, or transferring specific software versions between systems. It's also useful for analyzing package contents before installation or for backup purposes.
DIFFERENCE FROM <I>'DNF INSTALL --DOWNLOADONLY'</I>
While 'dnf install --downloadonly' also downloads packages without installing them, dnf download is generally preferred for pure download operations. The 'install --downloadonly' command still performs more extensive transaction checks and might involve temporary installations, which can sometimes be less efficient or desirable for simply fetching files.
HISTORY
The concept of downloading packages without installing them has been a long-standing requirement in RPM-based systems. In the older YUM package manager, this functionality was typically provided by a plugin like 'yum-plugin-downloadonly'. When DNF emerged as the successor to YUM, this critical feature was integrated directly as a subcommand, often bundled as part of dnf-plugins-core or directly available in modern DNF installations. This evolution reflects the increasing demand for robust package management tools that support flexible deployment and system administration strategies.