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]
PARAMETERS
--repoid=<repoid>
Specify the ID of the repository to synchronize. This option can be used multiple times to sync several repositories.
--download-path=<path>
Mandatory option. The directory where the synchronized repositories and their contents will be downloaded.
--remote-src
Download source RPMs (SRPMs) in addition to the binary packages. Useful for development or auditing purposes.
--delete
Remove local files and packages that are no longer present in the remote repository. This helps maintain an exact mirror and frees up disk space.
--newest-only
Download only the newest versions of packages for each repository. This can save disk space and synchronization time if older versions are not required.
--norepopath
Prevent the creation of a subdirectory named after the repository ID within the specified download path. By default, dnf-reposync creates such subdirectories.
--download-metadata
Download all available repository metadata files (e.g., repomd.xml, primary.xml.gz, filelists.xml.gz). This is essential for a functional local repository.
--arch=<arch>
Specify particular package architectures to download (e.g., x86_64, aarch64). This option can be used multiple times for multiple architectures.
--url=<url>
Synchronize a repository directly from the given base URL. This allows syncing repositories not defined in DNF configuration. Can be used multiple times.
--mirrorlist=<url>
Synchronize a repository using the provided mirror list URL. Similar to --url, for unconfigured repositories. Can be used multiple times.
DESCRIPTION
dnf-reposync is a powerful plugin for the DNF package manager, designed to synchronize remote DNF repositories to a local directory on your system. This utility is invaluable for creating local mirrors of official distribution repositories, enabling offline package installation, or preparing content for systems with restricted internet access. It downloads all necessary RPM packages, along with their associated metadata (like repomd.xml, primary.xml.gz, etc.), ensuring a complete and functional local copy of the chosen repositories.
The command allows for fine-grained control over the synchronization process, including specifying which repositories to sync, which architectures to include, and whether to download source RPMs. It also supports incremental synchronization, efficiently updating only new or changed packages and metadata on subsequent runs, thus saving bandwidth and time. This makes dnf-reposync an essential tool for system administrators managing enterprise environments, development teams needing consistent package sets, or users simply wanting reliable access to packages without constant internet reliance.
CAVEATS
Using dnf-reposync requires significant disk space, especially for large distribution repositories. The initial synchronization can be time-consuming and consume considerable network bandwidth. It's important to ensure your filesystem has enough free space before starting. While dnf-reposync downloads remote metadata, if you intend to serve this local mirror and later modify its contents (e.g., add custom packages), you will likely need to use createrepo_c to regenerate the repository metadata locally.
USAGE CONTEXT
dnf-reposync is a critical tool for maintaining secure and consistent software environments. It is widely used in enterprise settings for creating internal mirror servers, facilitating reproducible builds, supporting disconnected operations (air-gapped systems), and ensuring reliable access to package updates without external internet dependencies. It provides the foundation for robust infrastructure management.
INCREMENTAL SYNCHRONIZATION
A key feature of dnf-reposync is its ability to perform incremental synchronizations. After the initial download, subsequent runs will efficiently fetch only new or updated packages and metadata, significantly reducing bandwidth usage and execution time. This makes it practical for regular maintenance of local mirrors.
HISTORY
dnf-reposync emerged as the modern successor to the `reposync` command from the `yum-utils` package, adapting its functionality for the DNF package manager ecosystem. With the transition from YUM to DNF as the default package manager in Fedora and RHEL-based distributions, `dnf-reposync` was developed as a DNF plugin, becoming part of the `dnf-plugins-core` package. It leverages DNF's robust capabilities for dependency resolution and repository handling while providing dedicated features for local repository mirroring.
SEE ALSO
dnf(8), createrepo_c(8), reposync(1) (from yum-utils), yum-config-manager(1)


