User Tools

Site Tools


linux:yum_reposync

This is an old revision of the document!


Synchronize a reposory using reposync

# dnf install -y dnf-utils createrepo

The reposync command is used to synchronize a remote yum repository to a local directory, using yum to retrieve the packages.

# mkdir -p /software/redhat/8/base
# /usr/bin/reposync --newest-only --repoid=rh8_baseos_latest -p /software/redhat/8/base
# /usr/bin/createrepo /software/redhat/8/base

script example

#!/bin/bash

logpath=/var/log
logname=$logpath/repo_sync_$(date +%Y.%m.%d).log

# Remove old logs
find $logpath/repo_sync* -mtime +5 -delete; >> $logname 2>&1

# Sync repositories
/usr/bin/reposync --newest-only --repoid=rh8_baseos_latest -/software/redhat/8/base >> $logname 2>&1

/usr/bin/createrepo /software/redhat/8/base/getPackage/ >> $logname 2>&1

# reposync –gpgcheck -l –repoid=rhel-6-server-rpms –download_path=/var/www/html

Using a proxy with Yum

# vi /etc/yum.conf
proxy=http://someproxyserver.com:8000
proxy_username=proxyuser
proxy_password=proxypass
...

Man page reposync

synchronize yum repositories to a local directory

OPTIONS

-h, --help
    Display a help message, and then quit. 
-c CONFIG, --config=CONFIG
    Config file to use (defaults to /etc/yum.conf). 
-a ARCH, --arch=ARCH
    Act as if running the specified arch (default: current arch, note: does not override $releasever. x86_64 is a superset for i*86.). 
--source
    Also download .src.rpm files. 
-r REPOID, --repoid=REPOID
    Specify repo ids to query, can be specified multiple times (default is all enabled). 
-e CACHEDIR, --cachedir CACHEDIR
    Directory in which to store metadata. 
-t, --tempcache
    Use a temp dir for storing/accessing yum-cache. 
-d, --delete
    Delete local packages no longer present in repository. 
-p DESTDIR, --download_path=DESTDIR
    Path to download packages to: defaults to current directory. 
--norepopath
    Don't add the reponame to the download path. Can only be used when syncing a single repository (default is to add the reponame). 
-g, --gpgcheck
    Remove packages that fail GPG signature checking after downloading. exit status is '1' if at least one package was removed. 
-u, --urls
    Just list urls of what would be downloaded, don't download. 
-l, --plugins
    Enable yum plugin support. 
-m, --downloadcomps
    Also download comps.xml. 
--download-metadata
    Download all the non-default metadata. 
-n, --newest-only
    Download only newest packages per-repo. 
-q, --quiet
    Output as little information as possible. 
linux/yum_reposync.1627298676.txt.gz · Last modified: 2021/07/26 13:24 by manu