MiroirEOLE » Historique » Version 8
Version 7 (Daniel Dehennin, 27/02/2015 15:44) → Version 8/10 (Daniel Dehennin, 31/05/2016 15:13)
{{toc}}
h1. Mise en place d’un miroir des dépôts de paquet
h2. Introduction
Ce document décrit comment créer un miroir local des dépôts Ubuntu et project:eole.
La méta-distribution project:eole se compose de plusieurs sources de paquets :
# Les paquets de la distribution Ubuntu, nécessite à ce jour environ 900Gio 600Gio d’espace disque ;
# Les paquets du projet project: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":http://pcll.ac-dijon.fr/eole/contact/, vous devez donc nous communiquer l’adresse IP qui sera utilisée par votre serveur miroir.
h2. Utilisation de l’outil "ubumirror":https://launchpad.net/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":https://launchpad.net/ubumirror en appliquant des patchs :
* "Arrêt si le miroir distant est en synchronisation":https://code.launchpad.net/~launchpad-baby-gnu/ubumirror/feature-abort-on-remote-update-in-progress
* "Définition du fichier de configuration en ligne de commande":https://code.launchpad.net/~launchpad-baby-gnu/ubumirror/feature-set-config-and-log-files-from-command-line
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
# Télécharger les nouveaux paquets deb
# 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":https://code.launchpad.net/~launchpad-baby-gnu/ubumirror/feature-set-config-and-log-files-from-command-line.
Vous pouvez l’installer dans le répertoire de l’utilisateur qui fera la synchronisation :
* Créer les répertoires nécessaires
<pre>
ftp@server:~$ mkdir -p bin .config/ubumirror log.d src mirror
</pre>
* Télécharger le dépôt bzr
<pre>
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
</pre>
* Intégrer le premier patch
<pre>
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"
</pre>
* Intégrer le second patch
<pre>
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
</pre>
* Faire un lien symbolique pour l’installer
<pre>
ftp@server:~$ ln -s ~/src/bzr-ubumirror/jsnow/ubuarchive ~/bin/ubuarchive
</pre>
Un tâche cron permet une synchronisation régulière, par exemple :
<pre>
root@server:~$ crontab -u ftp -l
PATH=${HOME}/bin:${PATH}
15 3 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/test.conf
</pre>
En environnement nécessitant un mandataire HTTP, il est nécessaire d’exporter la variable *@RSYNC_PROXY@* :
* Utilisation d’un nom d’hôte
<pre>
RSYNC_PROXY=FQDN_PROXY:PORT
</pre>
* Utilisation d’une adresse IP
<pre>
RSYNC_PROXY=IP_PROXY:PORT
</pre>
h3. Miroir Ubuntu
Nous synchroniserons le miroir une fois par jour, dans la nuit :
<pre>
root@server:~$ crontab -u ftp -l
PATH=${HOME}/bin:${PATH}
15 3 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/ubuntu.conf
</pre>
Vous pouvez baser votre configuration sur le modèle suivant :
<pre>
#
# 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 \
"
</pre>
h3. Miroir EOLE 2.4 et plus
Nous synchroniserons le miroir une fois par jour, dans la nuit :
<pre>
root@server:~$ crontab -u ftp -l
PATH=${HOME}/bin:${PATH}
30 5 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/eole.conf
</pre>
Vous pouvez baser votre configuration sur le modèle suivant :
<pre>
#
# 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=""
</pre>
h3. Miroir Envole 4 et plus
Nous synchroniserons le miroir une fois par jour, dans la nuit :
<pre>
root@server:~$ crontab -u ftp -l
PATH=${HOME}/bin:${PATH}
30 6 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/envole.conf
</pre>
Vous pouvez baser votre configuration sur le modèle suivant :
<pre>
#
# 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=""
</pre>
h2. Miroir EOLE 2.3
La mise en place d’un miroir EOLE requiert une autorisation réseau préalable à "adresser à l’équipe EOLE":http://eole.orion.education.fr/index.php/contact, vous devez donc nous communiquer l’adresse IP qui sera utilisée par votre serveur miroir.
La récupération des paquets EOLE jusqu’à la version 2.3 se fait avec le script suivant :
<pre>
#!/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}"
</pre>
Vous pouvez ensuite planifier une tâche cron comme suit:
<pre>
SHELL=/bin/bash
PATH=~/.bin:/usr/bin:/bin
MAILTO=mirror-admin@example.net
0 5 * * * mirror-eole.sh > /dev/null
</pre>
h2. Publication de votre miroir
Il ne vous reste plus qu’à configurer un service HTTP ou FTP afin de rendre votre miroir accessible.
h1. Mise en place d’un miroir des dépôts de paquet
h2. Introduction
Ce document décrit comment créer un miroir local des dépôts Ubuntu et project:eole.
La méta-distribution project:eole se compose de plusieurs sources de paquets :
# Les paquets de la distribution Ubuntu, nécessite à ce jour environ 900Gio 600Gio d’espace disque ;
# Les paquets du projet project: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":http://pcll.ac-dijon.fr/eole/contact/, vous devez donc nous communiquer l’adresse IP qui sera utilisée par votre serveur miroir.
h2. Utilisation de l’outil "ubumirror":https://launchpad.net/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":https://launchpad.net/ubumirror en appliquant des patchs :
* "Arrêt si le miroir distant est en synchronisation":https://code.launchpad.net/~launchpad-baby-gnu/ubumirror/feature-abort-on-remote-update-in-progress
* "Définition du fichier de configuration en ligne de commande":https://code.launchpad.net/~launchpad-baby-gnu/ubumirror/feature-set-config-and-log-files-from-command-line
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
# Télécharger les nouveaux paquets deb
# 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":https://code.launchpad.net/~launchpad-baby-gnu/ubumirror/feature-set-config-and-log-files-from-command-line.
Vous pouvez l’installer dans le répertoire de l’utilisateur qui fera la synchronisation :
* Créer les répertoires nécessaires
<pre>
ftp@server:~$ mkdir -p bin .config/ubumirror log.d src mirror
</pre>
* Télécharger le dépôt bzr
<pre>
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
</pre>
* Intégrer le premier patch
<pre>
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"
</pre>
* Intégrer le second patch
<pre>
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
</pre>
* Faire un lien symbolique pour l’installer
<pre>
ftp@server:~$ ln -s ~/src/bzr-ubumirror/jsnow/ubuarchive ~/bin/ubuarchive
</pre>
Un tâche cron permet une synchronisation régulière, par exemple :
<pre>
root@server:~$ crontab -u ftp -l
PATH=${HOME}/bin:${PATH}
15 3 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/test.conf
</pre>
En environnement nécessitant un mandataire HTTP, il est nécessaire d’exporter la variable *@RSYNC_PROXY@* :
* Utilisation d’un nom d’hôte
<pre>
RSYNC_PROXY=FQDN_PROXY:PORT
</pre>
* Utilisation d’une adresse IP
<pre>
RSYNC_PROXY=IP_PROXY:PORT
</pre>
h3. Miroir Ubuntu
Nous synchroniserons le miroir une fois par jour, dans la nuit :
<pre>
root@server:~$ crontab -u ftp -l
PATH=${HOME}/bin:${PATH}
15 3 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/ubuntu.conf
</pre>
Vous pouvez baser votre configuration sur le modèle suivant :
<pre>
#
# 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 \
"
</pre>
h3. Miroir EOLE 2.4 et plus
Nous synchroniserons le miroir une fois par jour, dans la nuit :
<pre>
root@server:~$ crontab -u ftp -l
PATH=${HOME}/bin:${PATH}
30 5 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/eole.conf
</pre>
Vous pouvez baser votre configuration sur le modèle suivant :
<pre>
#
# 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=""
</pre>
h3. Miroir Envole 4 et plus
Nous synchroniserons le miroir une fois par jour, dans la nuit :
<pre>
root@server:~$ crontab -u ftp -l
PATH=${HOME}/bin:${PATH}
30 6 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/envole.conf
</pre>
Vous pouvez baser votre configuration sur le modèle suivant :
<pre>
#
# 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=""
</pre>
h2. Miroir EOLE 2.3
La mise en place d’un miroir EOLE requiert une autorisation réseau préalable à "adresser à l’équipe EOLE":http://eole.orion.education.fr/index.php/contact, vous devez donc nous communiquer l’adresse IP qui sera utilisée par votre serveur miroir.
La récupération des paquets EOLE jusqu’à la version 2.3 se fait avec le script suivant :
<pre>
#!/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}"
</pre>
Vous pouvez ensuite planifier une tâche cron comme suit:
<pre>
SHELL=/bin/bash
PATH=~/.bin:/usr/bin:/bin
MAILTO=mirror-admin@example.net
0 5 * * * mirror-eole.sh > /dev/null
</pre>
h2. Publication de votre miroir
Il ne vous reste plus qu’à configurer un service HTTP ou FTP afin de rendre votre miroir accessible.