Projet

Général

Profil

MiroirEOLE » Historique » Version 9

« Précédent - Version 9/10 (diff) - Suivant » - Version actuelle
Daniel Dehennin, 01/06/2016 15:25


Mise en place d’un miroir des dépôts de paquet

Introduction

Ce document décrit comment créer un miroir local des dépôts Ubuntu et EOLE.

La méta-distribution EOLE se compose de plusieurs sources de paquets :

  1. Les paquets de la distribution Ubuntu, nécessite à ce jour environ 900Gio d’espace disque ;
  2. Les paquets du projet EOLE, nécessite à ce jour environ 30Gio d’espace disque, toute version confondue.

La mise en place d’un miroir EOLE requiert une autorisation réseau préalable à adresser à l’équipe EOLE, vous devez donc nous communiquer l’adresse IP qui sera utilisée par votre serveur miroir.

Utilisation de l’outil ubumirror pour Ubuntu et EOLE >= 2.4

La mise en place d’un miroir de paquet deb est réalisée avec l’outil ubumirror en appliquant des patchs :

Cet outil se charge de faire la synchronisation en deux passes afin de ne pas avoir de paquets référencés dans des indexes qui ne sont pas encore téléchargés

  1. Télécharger les nouveaux paquets deb
  2. Mettre à jour les indexes (Releases, Packages, Sources...)

L’outil peut être utilisé par un utilisateur non root avec le patch Définition du fichier de configuration en ligne de commande.

Vous pouvez l’installer dans le répertoire de l’utilisateur qui fera la synchronisation :

  • Créer les répertoires nécessaires
    ftp@server:~$ mkdir -p bin .config/ubumirror log.d src mirror
    
  • Télécharger le dépôt bzr
    ftp@server:~$ bzr whoami "John Snow <john.snow@example.com>" 
    ftp@server:~$ bzr init-repo src/bzr-ubumirror
    ftp@server:~$ bzr branch lp:ubumirror src/bzr-ubumirror/jsnow
    ftp@server:~$ cd src/bzr-ubumirror/jsnow
    
  • Intégrer le premier patch
    ftp@server:~/src/bzr-ubumirror/jsnow$ bzr merge lp:~launchpad-baby-gnu/ubumirror/feature-abort-on-remote-update-in-progress
    ftp@server:~/src/bzr-ubumirror/jsnow$ bzr commit -m "Merge branch feature-abort-on-remote-update-in-progress" 
    
  • Intégrer le second patch
    ftp@server:~/src/bzr-ubumirror/jsnow$ bzr merge lp:~launchpad-baby-gnu/ubumirror/feature-set-config-and-log-files-from-command-line
    ftp@server:~/src/bzr-ubumirror/jsnow$ bzr commit -m "Merge branch feature-set-config-and-log-files-from-command-line" 
    ftp@server:~/src/bzr-ubumirror/jsnow$ cd
    
  • Faire un lien symbolique pour l’installer
    ftp@server:~$ ln -s ~/src/bzr-ubumirror/jsnow/ubuarchive ~/bin/ubuarchive
    

Un tâche cron permet une synchronisation régulière, par exemple :

root@server:~$ crontab -u ftp -l
PATH=${HOME}/bin:${PATH}
15 3 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/test.conf

En environnement nécessitant un mandataire HTTP, il est nécessaire d’exporter la variable RSYNC_PROXY :

  • Utilisation d’un nom d’hôte
    RSYNC_PROXY=FQDN_PROXY:PORT
    
  • Utilisation d’une adresse IP
    RSYNC_PROXY=IP_PROXY:PORT
    

Miroir Ubuntu

Nous synchroniserons le miroir une fois par jour, dans la nuit :

root@server:~$ crontab -u ftp -l
PATH=${HOME}/bin:${PATH}
15 3 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/ubuntu.conf

Vous pouvez baser votre configuration sur le modèle suivant en choisisant le miroir rsync à votre convenance :

#
#   ubumirror.conf - configuration file for the ubumirror scripts.
#

# Please set the variables below to fit your site.
# Which email address/user that will receive failure notices.
EMAIL=mirror-admin@exemple.net

# Server's FQDN.
HOSTNAME=$(hostname -f)

# Bandwidth limit for all mirror scripts - set to 0 for no limit.
SPEED=10240

# UBUARC_DIR is the destination for the base of the archive directory
# The script won't run if this variable isn't set
UBUARC_DIR="/home/ftp/mirror/ubuntu/" 

# LOGDIR is the destination directory of all the logs
LOGDIR="/home/ftp/log.d/ubuntu" 

# UBU{ARC,CDI,REL}_MIRROR is the rsync path in the form of host::directory/ of the
#   upstream mirrors where the ubumirror scripts will mirror from.
#UBUARC_MIRROR=ftp.crihan.fr::ubuntu/
UBUARC_MIRROR=rsync://ftp.lip6.fr/Ubuntu/archive/

# UBU{ARC,CDI,REL}_EXCLUDE is what things you want to exclude
UBUARC_EXCLUDE="\
 --exclude binary-powerpc/ --exclude binary-sparc/ \
 --exclude daily-installer-powerpc/ --exclude daily-installer-sparc/ \
 --exclude installer-powerpc/ --exclude installer-sparc/ \
 --exclude *_powerpc.deb --exclude *_powerpc.udeb \
 --exclude *_sparc.deb --exclude *_sparc.udeb \
 --exclude Contents-powerpc.gz --exclude Contents-sparc.gz \
 --exclude pool/local \
" 

Miroir EOLE 2.4 et plus

Nous synchroniserons le miroir une fois par jour, dans la nuit :

root@server:~$ crontab -u ftp -l
PATH=${HOME}/bin:${PATH}
30 5 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/eole.conf

Vous pouvez baser votre configuration sur le modèle suivant :

#
#   ubumirror.conf - configuration file for the ubumirror scripts.
#

# Please set the variables below to fit your site.
# Which email address/user that will receive failure notices.
EMAIL=mirror-admin@exemple.net

# Server's FQDN.
HOSTNAME=$(hostname -f)

# Bandwidth limit for all mirror scripts - set to 0 for no limit.
SPEED=10240

# UBUARC_DIR is the destination for the base of the archive directory
# The script won't run if this variable isn't set
UBUARC_DIR="/home/ftp/mirror/eole/" 

# LOGDIR is the destination directory of all the logs
LOGDIR="/home/ftp/log.d/eole" 

# UBU{ARC,CDI,REL}_MIRROR is the rsync path in the form of host::directory/ of the
#   upstream mirrors where the ubumirror scripts will mirror from.
UBUARC_MIRROR=rsync://eole.ac-dijon.fr/eole/

# UBU{ARC,CDI,REL}_EXCLUDE is what things you want to exclude
UBUARC_EXCLUDE="" 

Miroir Envole 4 et plus

Nous synchroniserons le miroir une fois par jour, dans la nuit :

root@server:~$ crontab -u ftp -l
PATH=${HOME}/bin:${PATH}
30 6 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/envole.conf

Vous pouvez baser votre configuration sur le modèle suivant :

#
#   ubumirror.conf - configuration file for the ubumirror scripts.
#

# Please set the variables below to fit your site.
# Which email address/user that will receive failure notices.
EMAIL=mirror-admin@exemple.net

# Server's FQDN.
HOSTNAME=$(hostname -f)

# Bandwidth limit for all mirror scripts - set to 0 for no limit.
SPEED=10240

# UBUARC_DIR is the destination for the base of the archive directory
# The script won't run if this variable isn't set
UBUARC_DIR="/home/ftp/mirror/envole/" 

# LOGDIR is the destination directory of all the logs
LOGDIR="/home/ftp/log.d/envole" 

# UBU{ARC,CDI,REL}_MIRROR is the rsync path in the form of host::directory/ of the
#   upstream mirrors where the ubumirror scripts will mirror from.
UBUARC_MIRROR=rsync://eole.ac-dijon.fr/envole/

# UBU{ARC,CDI,REL}_EXCLUDE is what things you want to exclude
UBUARC_EXCLUDE="" 

Miroir EOLE 2.3

La récupération des paquets EOLE jusqu’à la version 2.3 se fait avec le script suivant :

#!/bin/bash

set -e -u

MIRROR_SRC="eoleng.ac-dijon.fr::eoleng" 
MIRROR_DST="/home/ftp/mirror/eoleng" 
MIRROR_LOG_DIR="/home/ftp/mirror/log.d/eoleng" 
MIRROR_LOG_FILE="${MIRROR_LOG_DIR}/eole.log" 

RSYNC_OPTS="-v --force --recursive --times --perms --links --delete-after" 
RSYNC_EXCLUDE="--exclude mini-dinstall --exclude *.changes" 

test -d "${MIRROR_LOG_DIR}" || mkdir -p "${MIRROR_LOG_DIR}" 
savelog -t -n -r "${MIRROR_LOG_DIR}" "${MIRROR_LOG_FILE}" 

rsync ${RSYNC_OPTS} ${RSYNC_EXCLUDE} ${MIRROR_SRC} ${MIRROR_DST} | tee -a "${MIRROR_LOG_FILE}" 

Vous pouvez ensuite planifier une tâche cron comme suit:

SHELL=/bin/bash
PATH=~/.bin:/usr/bin:/bin
MAILTO=mirror-admin@example.net

0 5 * * * mirror-eole.sh > /dev/null

Publication de votre miroir

Il ne vous reste plus qu’à configurer un service HTTP ou FTP afin de rendre votre miroir accessible.