LinuxCommandLibrary

reposync

Synchronize remote package repositories

SYNOPSIS

reposync [options] [--repoid=] [...]

PARAMETERS

--repoid=<repoid>, -r <repoid>
    Specifies one or more repository IDs to synchronize.


--arch=<arch>
    Filters packages by specified architecture(s) (e.g., x86_64, noarch).


--delete
    Removes local packages that are no longer present in the remote repository.


--download-metadata
    Downloads all repository metadata (e.g., repomd.xml, primary.xml) necessary for a functional mirror.


--newest-only
    Downloads only the latest version of each package, by name and architecture.


--norepopath
    Prevents adding the repository ID as a subdirectory within the download path.


--gpgcheck
    Enables GPG signature verification for downloaded packages.


--source
    Synchronizes source RPM packages instead of binary packages.


--urls
    Instead of downloading packages, only prints their URLs to standard output.


--config=<file>
    Uses an alternative DNF/Yum configuration file.


--download-path=<path>
    Sets the base directory where synchronized content will be stored. Defaults to /var/cache/dnf or /var/lib/yum/repos/<repoid>.


--plugins
    Enables DNF plugins for the synchronization process.


-q, --quiet
    Suppresses most output messages.


-v, --verbose
    Increases the verbosity of output messages.


DESCRIPTION

reposync is a utility designed to synchronize remote DNF or older Yum repositories to a local directory.
It enables the creation of complete local mirrors, downloading all packages, metadata (repodata), and other essential files from specified repositories.
This functionality is invaluable for several use cases: providing offline access to packages, maintaining consistent package versions across multiple systems without relying on external network access for each, and significantly reducing internet bandwidth consumption within a local network by serving packages from a central mirror.
The command offers robust filtering capabilities, allowing users to specify architectures, download only the newest packages, or even sync source RPMs. It also provides options for managing existing local content, such as deleting packages no longer present in the remote repository.

CAVEATS

Disk Space Consumption: reposync can consume significant disk space, especially for large repositories or when syncing multiple architectures and versions. Plan storage accordingly.
Network Bandwidth: Initial synchronization or syncing large updates can use substantial network bandwidth.
Repository Configuration: Requires the target repositories to be defined and enabled in the system's DNF/Yum configuration files (e.g., in /etc/yum.repos.d/).
Metadata Generation: While --download-metadata fetches the remote metadata, creating a fully functional local repository often requires running createrepo_c on the synced directory afterward to generate local repodata, especially if serving via HTTP/NFS or for custom local repositories. This is not handled automatically by reposync itself.
Permissions: Requires appropriate write permissions to the specified download path, often root privileges for default system locations.

POST-SYNC METADATA GENERATION WITH CREATEREPO_C

After running reposync, especially if you intend to serve the synchronized content as a new local or network-accessible repository, it is generally recommended to execute createrepo_c on the root of your synced repository directory. For example, createrepo_c /path/to/your/synced/repo. This step generates or updates the local repository metadata, making it consumable by DNF/Yum clients.

SPECIFYING A CONFIGURATION FILE

Instead of relying on globally enabled repositories, you can direct reposync to use a specific repository definition file by using the --config option. For instance, reposync --config=/path/to/myrepo.repo --repoid=myrepo allows for syncing repositories not necessarily configured system-wide.

HISTORY

reposync originated as part of the yum-utils package, serving the Yum package manager in older Red Hat-based distributions. With the evolution to DNF as the primary package manager in Fedora and RHEL 8+, its functionality was adapted and integrated into the dnf-utils package (or directly within DNF's ecosystem in some versions). Despite this transition, its fundamental purpose of providing robust repository synchronization capabilities has remained a core utility for system administrators and developers managing package mirrors.

SEE ALSO

dnf(8), yum(8), createrepo_c(8)

Copied to clipboard