Product SiteDocumentation Site

9.4. Creando espejos YUM con reposync

reposync se utiliza para sincronizar un repositorio remoto YUM con un directorio local utilizando yum para recuperar los paquetes.
Uso:
reposync [options]
Opciones:
Options:
  -h, --help            show this help message and exit
  -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)
  -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 dir
  -g, --gpgcheck        Remove packages that fail GPG signature checking after
                        downloading
  -u, --urls            Just list urls of what would be downloaded, don't
                        download
  -n, --newest-only     Download only newest packages per-repo
  -q, --quiet           Output as little as possible
  -l, --plugins         enable yum plugin support
A partir del directorio local con los rpms, es trivial reconstruir los metadatos con createrepo.
Ejemplo de uso para sincronizar con el repositorio ejemplo rubyera.
$ reposync --repoid=rubyera 
rubyera                                              | 3.2 kB     00:00 ... 
[rubyera: 1     of 14    ] Downloading dhcp_probe-1.3.0-2.fc13.x86_64.rpm
[rubyera: 2     of 14    ] Downloading dhcp_probe-1.3.0-4.fc13.x86_64.rpm
[rubyera: 3     of 14    ] Downloading dhcp_probe-1.3.0-3.fc13.x86_64.rpm
[rubyera: 4     of 14    ] Downloading dhcp_probe-debuginfo-1.3.0-2.fc13.x86_64.rpm
[rubyera: 5     of 14    ] Downloading dhcp_probe-debuginfo-1.3.0-4.fc13.x86_64.rpm
[rubyera: 6     of 14    ] Downloading dhcp_probe-debuginfo-1.3.0-3.fc13.x86_64.rpm
[rubyera: 7     of 14    ] Downloading dhcp_probe-debuginfo-1.3.0-1.fc13.x86_64.rpm
[rubyera: 8     of 14    ] Downloading iptables-1.4.5-1.fc12.x86_64.rpm
[rubyera: 9     of 14    ] Downloading iptables-debuginfo-1.4.5-1.fc12.x86_64.rpm
[rubyera: 10    of 14    ] Downloading iptables-devel-1.4.5-1.fc12.x86_64.rpm
[rubyera: 11    of 14    ] Downloading iptables-ipv6-1.4.5-1.fc12.x86_64.rpm
[rubyera: 12    of 14    ] Downloading passenger-2.2.15-1.fc13.x86_64.rpm
[rubyera: 13    of 14    ] Downloading passenger-debuginfo-2.2.15-1.fc13.x86_64.rpm
[rubyera: 14    of 14    ] Downloading rubygem-pg-0.9.0-1.fc13.x86_64.rpm
Si se intenta nuevamente sincronizar, reposync no volverá a descargar los paquetes existentes ahorrando ancho de banda.
$ reposync --repoid=rubyera 
[rubyera: 1     of 14    ] Skipping existing dhcp_probe-1.3.0-2.fc13.x86_64.rpm
[rubyera: 2     of 14    ] Skipping existing dhcp_probe-1.3.0-4.fc13.x86_64.rpm
[rubyera: 3     of 14    ] Skipping existing dhcp_probe-1.3.0-3.fc13.x86_64.rpm
[rubyera: 4     of 14    ] Skipping existing dhcp_probe-debuginfo-1.3.0-2.fc13.x86_64.rpm
[rubyera: 5     of 14    ] Skipping existing dhcp_probe-debuginfo-1.3.0-4.fc13.x86_64.rpm
[rubyera: 6     of 14    ] Skipping existing dhcp_probe-debuginfo-1.3.0-3.fc13.x86_64.rpm
[rubyera: 7     of 14    ] Skipping existing dhcp_probe-debuginfo-1.3.0-1.fc13.x86_64.rpm
[rubyera: 8     of 14    ] Skipping existing iptables-1.4.5-1.fc12.x86_64.rpm
[rubyera: 9     of 14    ] Skipping existing iptables-debuginfo-1.4.5-1.fc12.x86_64.rpm
[rubyera: 10    of 14    ] Skipping existing iptables-devel-1.4.5-1.fc12.x86_64.rpm
[rubyera: 11    of 14    ] Skipping existing iptables-ipv6-1.4.5-1.fc12.x86_64.rpm
[rubyera: 12    of 14    ] Skipping existing passenger-2.2.15-1.fc13.x86_64.rpm
[rubyera: 13    of 14    ] Skipping existing passenger-debuginfo-2.2.15-1.fc13.x86_64.rpm
[rubyera: 14    of 14    ] Skipping existing rubygem-pg-0.9.0-1.fc13.x86_64.rpm
Un ejemplo de uso es crear un espejo local del repositorio fedora y otro del repositorio updates y usar dichos repositorios localmente. De esta forma sería sumamente rápido instalar y actualizar paquetes. Lo importante es mantener sincronizado regularmente el repositorio espejo local con el repositorio maestro correspondiente llamando por ejemplo cada hora a reposync y a createrepo. Es importante notar que el archivo de grupos no es descargado por reposync. Use wget o curl para descargarlo.
Una de las ventajas de usar reposync en vez de por ejemplo espejado con rsync, ftp o http, es que reposync al trabajar con yum se beneficia del listado de espejos existentes en la definición del repositorio que se quiere espejar. A cambio, cuando se usa rsync,ftp o http, se depende de un servidor maestro único, que si falla, es más difícil recuperarse de dicha falla y manejarla, con reposync es totalmente transparente y simple de hacer.