dnf-reposync
Synchronize DNF repositories locally
TLDR
Synchronize all packages from the repository with id repo_name to a subdirectory repo_name of the current working directory
Synchronize all packages and define a custom save location
Synchronize all packages and metadata
Download only newest packages per-repo
Just print URLs of what would be downloaded, don't download
Try to set the timestamps of the downloaded files to those on the remote side
SYNOPSIS
dnf-reposync [options] [repoid-glob]
PARAMETERS
--arch=
Download packages matching listed architectures (default: system arch)
--allow-path-traversal
Allow packages with relative paths outside download dir
--config=
Config file location (default: /etc/dnf/dnf.conf)
--delete
Remove local packages no longer in remote repo
--diskspace
Check available disk space before download
--download-debug
Download *-debuginfo and *-debugsource packages
--download-metadata
Download all non-default metadata
--download-path=
Top directory for packages and metadata (required)
--downloadcomps
Download comps.xml group metadata
--gpgcheck
Enable GPG signature verification (default)
--nogpgcheck
Disable GPG checks
--newest-only
Download only newest package version per name
--quiet, -q
Quiet mode, show only errors
--refresh
Force refresh of repository metadata
--releasever=
Override $releasever macro
--repofrompath=
Add repo from directory path
--repoid=
Sync specific repo(s); use --all for all enabled
--source, -s
Download source RPMs instead of binaries
--tempdir=
Temporary directory for transactions
--totalprogress
Show total download progress
--type=
Package types: rpm (default), srpm
--urls
List URLs of packages instead of downloading
--verbose, -v
Verbose mode
DESCRIPTION
dnf-reposync is a powerful command-line utility in DNF (Dandified YUM), the package manager for Fedora, RHEL, CentOS Stream, and other RPM-based distributions. It downloads packages and metadata from remote repositories to a local directory, creating a synchronized local mirror. This is essential for network administrators setting up internal mirrors, reducing bandwidth usage, improving installation speeds in air-gapped environments, or caching updates for multiple systems.
The tool supports selective downloads based on architecture, repository ID, package types (RPMs, SRPMs, debuginfo), and metadata like comps.xml for groups. It can perform full syncs or incremental updates by downloading only new or changed files, respecting GPG signatures for security. When run repeatedly on the same download-path, it efficiently updates the mirror without duplicating data.
Configuration uses standard DNF repo files from /etc/yum.repos.d/, with overrides via options. After syncing, tools like createrepo generate repodata for client consumption. It's a direct evolution from yum-reposync, optimized for modern DNF features like modular repos and better parallel downloads.
CAVEATS
Requires significant disk space; run as root for full access. Incremental syncs assume consistent download-path. Network/firewall issues may interrupt large syncs. Not for containerized or modular repos without extra config.
USAGE EXAMPLE
dnf-reposync -p /var/www/html/mirror --repoid=fedora --newest-only
Synchronizes newest Fedora packages to web-accessible mirror.
POST-SYNC
Run createrepo_c /path/to/mirror to generate repodata.xml for DNF/Yum clients.
HISTORY
Introduced with DNF 2.0 in Fedora 25 (2016), replacing yum-reposync from Yum 3.x. Enhanced in DNF 4+ for RHEL 8+ with module support, parallel downloads, and better metadata handling. Actively maintained by Fedora Project.
SEE ALSO
dnf(8), yum-reposync(1), createrepo(8), reposync(1), modifyrepo(8)


