Reposync Command
Synopsis
dnf5 [GLOBAL OPTIONS] reposync [OPTIONS]
Description
The reposync command creates local copies of remote repositories. It avoids re-downloading packages that are already present in the local directory.
By default, reposync synchronizes all enabled repositories. However, you can customize the set of repositories to be synchronized using standard DNF5 options such as --repo, --enable-repo, or --disable-repo.
Options
--arch=<architecture>, -a <architecture>Download only packages for the specified architecture. This option can be specified multiple times. The default behavior is to download packages for all architectures.
--deleteRemove local packages that are no longer present in the remote repository.
--destdir=<path>Specifies the root path where downloaded repositories are stored, relative to the current working directory. Defaults to the current working directory. Each downloaded repository will have a subdirectory named after its ID within this path.
--download-metadataDownload all repository metadata. The downloaded copy is instantly usable as a repository without the need to run
createrepo_c. When used with--newest-only, only the latest package versions are downloaded. However, the metadata will still reference also older packages. To avoid issues caused by missing RPM files, consider updating the metadata usingcreaterepo_c --update. Otherwise, DNF will encounter errors when attempting to install older packages.--gpgcheck, -gRemove packages that fail OpenPGP signature verification after downloading. The command exits with a code of
1if at least one package is removed.Note: For repositories configured with
gpgcheck=0, OpenPGP signatures are not checked, even when this option is used.--metadata-path=<path>Specifies the root path where downloaded metadata files are stored. If not specified, it defaults to the value of
--destdir.--newest-only, -nDownload only the latest package versions from each repository.
--norepopathPrevents the repository id from being added to the download path. This option can only be used when syncing a single repository. (The default behavior adds the repository id to the path.)
--remote-timeAttempts to set the timestamps of local downloaded files to match those on the remote side.
--safe-write-path=<path>Defines the filesystem path prefix where reposync is allowed to write files. If not specified, it defaults to the repository’s download path. This option is useful for repositories that use relative locations of packages leading outside of the repository directory (e.g.,
../packages_store/foo.rpm).Caution: Any file under the
safe-write-pathcan be overwritten. This option can only be used when syncing a single repository.--srpmDownloads source packages. Equivalent to using
--arch=src.--urls, -uPrints the URLs of the files that would be downloaded without actually downloading them.
Examples
dnf reposync --repoid=the_repoSynchronize all packages from the repository with id
the_repo. The synchronized copy is saved inthe_reposubdirectory of the current working directory.dnf reposync --destdir=/my/repos/path --repoid=the_repoSynchronize all packages from the repository with id
the_repo. In this case files are saved in/my/repos/path/the_repodirectory.dnf reposync --repoid=the_repo --download-metadataSynchronize all packages and metadata from
the_reporepository.Repository synchronized with
--download-metadataoption can be directly used with DNF for example by using--repofrompathoption:dnf --repofrompath=syncedrepo,the_repo --repoid=syncedrepo list --available