Projet

Général

Profil

MiroirEOLE » Historique » Version 6

Thierry Bertrand, 12/02/2015 09:43

1 1 Daniel Dehennin
{{toc}}
2 1 Daniel Dehennin
3 1 Daniel Dehennin
h1. Mise en place d’un miroir des dépôts de paquet
4 1 Daniel Dehennin
5 1 Daniel Dehennin
h2. Introduction
6 1 Daniel Dehennin
7 1 Daniel Dehennin
Ce document décrit comment créer un miroir local des dépôts Ubuntu et EOLE.
8 1 Daniel Dehennin
9 1 Daniel Dehennin
La méta-distribution EOLE se compose de deux sources de paquets:
10 1 Daniel Dehennin
11 1 Daniel Dehennin
1. Les paquets de la distribution Ubuntu, nécessite à ce jour environ 600Gio d’espace disque ;
12 1 Daniel Dehennin
13 1 Daniel Dehennin
2. Les paquets du projet EOLE, nécessite à ce jour environ 15Gio d’espace disque.
14 1 Daniel Dehennin
15 1 Daniel Dehennin
La mise en place d’un miroir ce fait donc en deux étapes.
16 1 Daniel Dehennin
17 1 Daniel Dehennin
h2. Miroir Ubuntu
18 1 Daniel Dehennin
19 4 Daniel Dehennin
La mise en place d’un miroir Ubuntu est faisable avec l’outil "ubumirror":https://launchpad.net/ubuntu/%2Bsource/ubumirror en appliquant les patchs fournis en réponse aux bugs "663992":https://bugs.launchpad.net/ubuntu/%2Bsource/ubumirror/%2Bbug/663992 et "939379":https://bugs.launchpad.net/ubuntu/%2Bsource/ubumirror/%2Bbug/939379
20 1 Daniel Dehennin
21 1 Daniel Dehennin
La configuration utilisée par le projet EOLE est la suivante
22 1 Daniel Dehennin
23 1 Daniel Dehennin
<pre>
24 1 Daniel Dehennin
#
25 1 Daniel Dehennin
#   ubumirror.conf - configuration file for the ubumirror scripts.
26 1 Daniel Dehennin
#
27 1 Daniel Dehennin
28 1 Daniel Dehennin
# Please set the variables below to fit your site.
29 1 Daniel Dehennin
# Which email address/user that will receive failure notices.
30 1 Daniel Dehennin
EMAIL=mirror-admin@exemple.net
31 1 Daniel Dehennin
32 1 Daniel Dehennin
# Server's FQDN.
33 1 Daniel Dehennin
HOSTNAME=$(hostname -f)
34 1 Daniel Dehennin
35 1 Daniel Dehennin
# Bandwidth limit for all mirror scripts - set to 0 for no limit.
36 1 Daniel Dehennin
SPEED=10240
37 1 Daniel Dehennin
38 1 Daniel Dehennin
# UBUARC_DIR is the destination for the base of the archive directory
39 1 Daniel Dehennin
# The script won't run if this variable isn't set
40 1 Daniel Dehennin
UBUARC_DIR="/home/ftp/mirror/ubuntu/"
41 1 Daniel Dehennin
42 1 Daniel Dehennin
# UBUCDI_DIR is the destination for the base of the cdimage directory
43 1 Daniel Dehennin
# The script won't run if this variable isn't set
44 1 Daniel Dehennin
#UBUCDI_DIR="/srv/mirror/ubuntu-cdimage"
45 1 Daniel Dehennin
46 1 Daniel Dehennin
# UBUREL_DIR is the destination for the base of the releases directory
47 1 Daniel Dehennin
# The script won't run if this variable isn't set
48 1 Daniel Dehennin
#UBUREL_DIR="/srv/mirror/ubuntu-releases"
49 1 Daniel Dehennin
50 1 Daniel Dehennin
# UBUPOR_DIR is the destination for the base of the ports directory
51 1 Daniel Dehennin
# The script (ubuports) won't run if this variable isn't set
52 1 Daniel Dehennin
#UBUPOR_DIR="/srv/mirror/ubuntu-ports"
53 1 Daniel Dehennin
54 1 Daniel Dehennin
# LOGDIR is the destination directory of all the logs
55 1 Daniel Dehennin
LOGDIR="/hom/ftp/mirror/log.d/ubumirror/"
56 1 Daniel Dehennin
57 1 Daniel Dehennin
# UBU{ARC,CDI,REL}_MIRROR is the rsync path in the form of host::directory/ of the
58 1 Daniel Dehennin
#   upstream mirrors where the ubumirror scripts will mirror from.
59 1 Daniel Dehennin
UBUARC_MIRROR=ftp.crihan.fr::ubuntu/
60 1 Daniel Dehennin
# UBUCDI_MIRROR=cdimage.ubuntu.com::cdimage/
61 1 Daniel Dehennin
# UBUREL_MIRROR=rsync.releases.ubuntu.com::releases/
62 1 Daniel Dehennin
# UBUPOR_MIRROR=ports.ubuntu.com::ubuntu-ports/
63 1 Daniel Dehennin
64 1 Daniel Dehennin
# UBUCDI_FLAVOURS is the set of image flavours to pull from UBICDI_MIRROR
65 1 Daniel Dehennin
# flavour names must match directory names on the mirror
66 1 Daniel Dehennin
# UBUCDI_FLAVOURS="\
67 1 Daniel Dehennin
#   daily daily-live \
68 1 Daniel Dehennin
#   ubuntu-netbook/daily-live ubuntu-server/daily \
69 1 Daniel Dehennin
# "
70 1 Daniel Dehennin
71 1 Daniel Dehennin
# UBU{ARC,CDI,REL}_EXCLUDE is what things you want to exclude
72 1 Daniel Dehennin
UBUARC_EXCLUDE="\
73 1 Daniel Dehennin
 --exclude binary-powerpc/ --exclude binary-sparc/ \
74 1 Daniel Dehennin
 --exclude daily-installer-powerpc/ --exclude daily-installer-sparc/ \
75 1 Daniel Dehennin
 --exclude installer-powerpc/ --exclude installer-sparc/ \
76 1 Daniel Dehennin
 --exclude *_powerpc.deb --exclude *_powerpc.udeb \
77 1 Daniel Dehennin
 --exclude *_sparc.deb --exclude *_sparc.udeb \
78 1 Daniel Dehennin
 --exclude Contents-powerpc.gz --exclude Contents-sparc.gz \
79 1 Daniel Dehennin
 --exclude pool/local \
80 1 Daniel Dehennin
"
81 1 Daniel Dehennin
UBUCDI_EXCLUDE="\
82 1 Daniel Dehennin
#  --exclude *-powerpc.* --exclude *-sparc.* \
83 1 Daniel Dehennin
#  --exclude source/ \
84 1 Daniel Dehennin
"
85 1 Daniel Dehennin
UBUREL_EXCLUDE="\
86 1 Daniel Dehennin
#  --exclude *-powerpc.* --exclude *-sparc.* \
87 1 Daniel Dehennin
"
88 1 Daniel Dehennin
UBUPOR_EXCLUDE="\
89 1 Daniel Dehennin
#  --exclude binary-powerpc/ --exclude binary-sparc/ \
90 1 Daniel Dehennin
#  --exclude daily-installer-powerpc/ --exclude daily-installer-sparc/ \
91 1 Daniel Dehennin
#  --exclude installer-powerpc/ --exclude installer-sparc/ \
92 1 Daniel Dehennin
#  --exclude *_powerpc.deb --exclude *_powerpc.udeb \
93 1 Daniel Dehennin
#  --exclude *_sparc.deb --exclude *_sparc.udeb \
94 1 Daniel Dehennin
#  --exclude Contents-powerpc.gz --exclude Contents-sparc.gz \
95 1 Daniel Dehennin
"
96 1 Daniel Dehennin
</pre>
97 1 Daniel Dehennin
98 5 Daniel Dehennin
h2. Miroir EOLE 2.4 et plus
99 5 Daniel Dehennin
100 5 Daniel Dehennin
La mise en place d’un miroir EOLE pour les versions 2.4 et plus est faisable avec l’outil "ubumirror":https://launchpad.net/ubuntu/%2Bsource/ubumirror en appliquant les patchs fournis en réponse aux bugs "663992":https://bugs.launchpad.net/ubuntu/%2Bsource/ubumirror/%2Bbug/663992 et "939379":https://bugs.launchpad.net/ubuntu/%2Bsource/ubumirror/%2Bbug/939379
101 5 Daniel Dehennin
102 5 Daniel Dehennin
Vous pouvez baser votre configuration sur le modèle suivant :
103 5 Daniel Dehennin
<pre>
104 5 Daniel Dehennin
#
105 5 Daniel Dehennin
#   ubumirror.conf - configuration file for the ubumirror scripts.
106 5 Daniel Dehennin
#
107 5 Daniel Dehennin
108 5 Daniel Dehennin
# Please set the variables below to fit your site.
109 5 Daniel Dehennin
# Which email address/user that will receive failure notices.
110 5 Daniel Dehennin
EMAIL=mirror-admin@exemple.net
111 5 Daniel Dehennin
112 5 Daniel Dehennin
# Server's FQDN.
113 5 Daniel Dehennin
HOSTNAME=$(hostname -f)
114 5 Daniel Dehennin
115 5 Daniel Dehennin
# Bandwidth limit for all mirror scripts - set to 0 for no limit.
116 5 Daniel Dehennin
SPEED=10240
117 5 Daniel Dehennin
118 5 Daniel Dehennin
# UBUARC_DIR is the destination for the base of the archive directory
119 5 Daniel Dehennin
# The script won't run if this variable isn't set
120 5 Daniel Dehennin
UBUARC_DIR="/home/ftp/mirror/eole/"
121 5 Daniel Dehennin
122 5 Daniel Dehennin
# UBUCDI_DIR is the destination for the base of the cdimage directory
123 5 Daniel Dehennin
# The script won't run if this variable isn't set
124 5 Daniel Dehennin
#UBUCDI_DIR="/srv/mirror/ubuntu-cdimage"
125 5 Daniel Dehennin
126 5 Daniel Dehennin
# UBUREL_DIR is the destination for the base of the releases directory
127 5 Daniel Dehennin
# The script won't run if this variable isn't set
128 5 Daniel Dehennin
#UBUREL_DIR="/srv/mirror/ubuntu-releases"
129 5 Daniel Dehennin
130 5 Daniel Dehennin
# UBUPOR_DIR is the destination for the base of the ports directory
131 5 Daniel Dehennin
# The script (ubuports) won't run if this variable isn't set
132 5 Daniel Dehennin
#UBUPOR_DIR="/srv/mirror/ubuntu-ports"
133 5 Daniel Dehennin
134 5 Daniel Dehennin
# LOGDIR is the destination directory of all the logs
135 5 Daniel Dehennin
LOGDIR="/home/ftp/mirror/log.d/ubumirror/"
136 5 Daniel Dehennin
137 5 Daniel Dehennin
# UBU{ARC,CDI,REL}_MIRROR is the rsync path in the form of host::directory/ of the
138 5 Daniel Dehennin
#   upstream mirrors where the ubumirror scripts will mirror from.
139 5 Daniel Dehennin
UBUARC_MIRROR=rsync://eole.ac-dijon.fr/eole/
140 5 Daniel Dehennin
# UBUCDI_MIRROR=cdimage.ubuntu.com::cdimage/
141 5 Daniel Dehennin
# UBUREL_MIRROR=rsync.releases.ubuntu.com::releases/
142 5 Daniel Dehennin
# UBUPOR_MIRROR=ports.ubuntu.com::ubuntu-ports/
143 5 Daniel Dehennin
144 5 Daniel Dehennin
# UBUCDI_FLAVOURS is the set of image flavours to pull from UBICDI_MIRROR
145 5 Daniel Dehennin
# flavour names must match directory names on the mirror
146 5 Daniel Dehennin
# UBUCDI_FLAVOURS="\
147 5 Daniel Dehennin
#   daily daily-live \
148 5 Daniel Dehennin
#   ubuntu-netbook/daily-live ubuntu-server/daily \
149 5 Daniel Dehennin
# "
150 5 Daniel Dehennin
151 5 Daniel Dehennin
# UBU{ARC,CDI,REL}_EXCLUDE is what things you want to exclude
152 5 Daniel Dehennin
UBUARC_EXCLUDE=""
153 5 Daniel Dehennin
UBUCDI_EXCLUDE="\
154 5 Daniel Dehennin
#  --exclude *-powerpc.* --exclude *-sparc.* \
155 5 Daniel Dehennin
#  --exclude source/ \
156 5 Daniel Dehennin
"
157 5 Daniel Dehennin
UBUREL_EXCLUDE="\
158 5 Daniel Dehennin
#  --exclude *-powerpc.* --exclude *-sparc.* \
159 5 Daniel Dehennin
"
160 5 Daniel Dehennin
UBUPOR_EXCLUDE="\
161 5 Daniel Dehennin
#  --exclude binary-powerpc/ --exclude binary-sparc/ \
162 5 Daniel Dehennin
#  --exclude daily-installer-powerpc/ --exclude daily-installer-sparc/ \
163 5 Daniel Dehennin
#  --exclude installer-powerpc/ --exclude installer-sparc/ \
164 5 Daniel Dehennin
#  --exclude *_powerpc.deb --exclude *_powerpc.udeb \
165 5 Daniel Dehennin
#  --exclude *_sparc.deb --exclude *_sparc.udeb \
166 5 Daniel Dehennin
#  --exclude Contents-powerpc.gz --exclude Contents-sparc.gz \
167 5 Daniel Dehennin
"
168 5 Daniel Dehennin
</pre>
169 5 Daniel Dehennin
170 6 Thierry Bertrand
En environnement proxyfié, il est nécessaire d'utiliser la variable
171 6 Thierry Bertrand
<pre>
172 6 Thierry Bertrand
RSYNC_PROXY=FQDN_PROXY:PORT
173 6 Thierry Bertrand
ou
174 6 Thierry Bertrand
RSYNC_PROXY=IP_PROXY:PORT
175 6 Thierry Bertrand
</pre>
176 3 Daniel Dehennin
h2. Miroir EOLE 2.3
177 1 Daniel Dehennin
178 3 Daniel Dehennin
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. 
179 1 Daniel Dehennin
180 1 Daniel Dehennin
La récupération des paquets EOLE jusqu’à la version 2.3 se fait avec le script suivant :
181 1 Daniel Dehennin
182 1 Daniel Dehennin
<pre>
183 1 Daniel Dehennin
#!/bin/bash
184 1 Daniel Dehennin
185 1 Daniel Dehennin
set -e -u
186 1 Daniel Dehennin
187 1 Daniel Dehennin
MIRROR_SRC="eoleng.ac-dijon.fr::eoleng"
188 1 Daniel Dehennin
MIRROR_DST="/home/ftp/mirror/eoleng"
189 1 Daniel Dehennin
MIRROR_LOG_DIR="/home/ftp/mirror/log.d/eoleng"
190 1 Daniel Dehennin
MIRROR_LOG_FILE="${MIRROR_LOG_DIR}/eole.log"
191 1 Daniel Dehennin
192 1 Daniel Dehennin
RSYNC_OPTS="-v --force --recursive --times --perms --links --delete-after"
193 1 Daniel Dehennin
RSYNC_EXCLUDE="--exclude mini-dinstall --exclude *.changes"
194 1 Daniel Dehennin
195 1 Daniel Dehennin
test -d "${MIRROR_LOG_DIR}" || mkdir -p "${MIRROR_LOG_DIR}"
196 1 Daniel Dehennin
savelog -t -n -r "${MIRROR_LOG_DIR}" "${MIRROR_LOG_FILE}"
197 1 Daniel Dehennin
198 1 Daniel Dehennin
rsync ${RSYNC_OPTS} ${RSYNC_EXCLUDE} ${MIRROR_SRC} ${MIRROR_DST} | tee -a "${MIRROR_LOG_FILE}"
199 1 Daniel Dehennin
</pre>
200 1 Daniel Dehennin
201 1 Daniel Dehennin
Vous pouvez ensuite planifier une tâche cron comme suit:
202 1 Daniel Dehennin
203 1 Daniel Dehennin
<pre>
204 1 Daniel Dehennin
SHELL=/bin/bash
205 1 Daniel Dehennin
PATH=~/.bin:/usr/bin:/bin
206 1 Daniel Dehennin
MAILTO=mirror-admin@example.net
207 1 Daniel Dehennin
208 1 Daniel Dehennin
0 5 * * * mirror-eole.sh > /dev/null
209 1 Daniel Dehennin
</pre>
210 2 Daniel Dehennin
211 2 Daniel Dehennin
h2. Publication de votre miroir
212 2 Daniel Dehennin
213 2 Daniel Dehennin
Il ne vous reste plus qu’à configurer un service HTTP ou FTP afin de rendre votre miroir accessible.