MiroirEOLE » Historique » Version 8
Daniel Dehennin, 31/05/2016 15:13
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 | 7 | Daniel Dehennin | Ce document décrit comment créer un miroir local des dépôts Ubuntu et project:eole. |
8 | 1 | Daniel Dehennin | |
9 | 7 | Daniel Dehennin | La méta-distribution project:eole se compose de plusieurs sources de paquets : |
10 | 1 | Daniel Dehennin | |
11 | 8 | Daniel Dehennin | # Les paquets de la distribution Ubuntu, nécessite à ce jour environ 900Gio d’espace disque ; |
12 | 7 | Daniel Dehennin | # Les paquets du projet project:eole, nécessite à ce jour environ 30Gio d’espace disque, toute version confondue. |
13 | 1 | Daniel Dehennin | |
14 | 8 | Daniel Dehennin | 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. |
15 | 1 | Daniel Dehennin | |
16 | 7 | Daniel Dehennin | h2. Utilisation de l’outil "ubumirror":https://launchpad.net/ubumirror pour Ubuntu et EOLE >= 2.4 |
17 | 1 | Daniel Dehennin | |
18 | 7 | Daniel Dehennin | 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 : |
19 | 1 | Daniel Dehennin | |
20 | 7 | Daniel Dehennin | * "Arrêt si le miroir distant est en synchronisation":https://code.launchpad.net/~launchpad-baby-gnu/ubumirror/feature-abort-on-remote-update-in-progress |
21 | 7 | Daniel Dehennin | * "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 |
22 | 1 | Daniel Dehennin | |
23 | 7 | Daniel Dehennin | 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 |
24 | 1 | Daniel Dehennin | |
25 | 7 | Daniel Dehennin | # Télécharger les nouveaux paquets deb |
26 | 7 | Daniel Dehennin | # Mettre à jour les indexes (*@Releases@*, *@Packages@*, *@Sources@*...) |
27 | 7 | Daniel Dehennin | |
28 | 7 | Daniel Dehennin | 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. |
29 | 7 | Daniel Dehennin | |
30 | 7 | Daniel Dehennin | Vous pouvez l’installer dans le répertoire de l’utilisateur qui fera la synchronisation : |
31 | 7 | Daniel Dehennin | |
32 | 7 | Daniel Dehennin | * Créer les répertoires nécessaires |
33 | 1 | Daniel Dehennin | <pre> |
34 | 7 | Daniel Dehennin | ftp@server:~$ mkdir -p bin .config/ubumirror log.d src mirror |
35 | 7 | Daniel Dehennin | </pre> |
36 | 7 | Daniel Dehennin | * Télécharger le dépôt bzr |
37 | 7 | Daniel Dehennin | <pre> |
38 | 7 | Daniel Dehennin | ftp@server:~$ bzr whoami "John Snow <john.snow@example.com>" |
39 | 7 | Daniel Dehennin | ftp@server:~$ bzr init-repo src/bzr-ubumirror |
40 | 7 | Daniel Dehennin | ftp@server:~$ bzr branch lp:ubumirror src/bzr-ubumirror/jsnow |
41 | 7 | Daniel Dehennin | ftp@server:~$ cd src/bzr-ubumirror/jsnow |
42 | 7 | Daniel Dehennin | </pre> |
43 | 7 | Daniel Dehennin | * Intégrer le premier patch |
44 | 7 | Daniel Dehennin | <pre> |
45 | 7 | Daniel Dehennin | ftp@server:~/src/bzr-ubumirror/jsnow$ bzr merge lp:~launchpad-baby-gnu/ubumirror/feature-abort-on-remote-update-in-progress |
46 | 7 | Daniel Dehennin | ftp@server:~/src/bzr-ubumirror/jsnow$ bzr commit -m "Merge branch feature-abort-on-remote-update-in-progress" |
47 | 7 | Daniel Dehennin | </pre> |
48 | 7 | Daniel Dehennin | * Intégrer le second patch |
49 | 7 | Daniel Dehennin | <pre> |
50 | 7 | Daniel Dehennin | ftp@server:~/src/bzr-ubumirror/jsnow$ bzr merge lp:~launchpad-baby-gnu/ubumirror/feature-set-config-and-log-files-from-command-line |
51 | 7 | Daniel Dehennin | ftp@server:~/src/bzr-ubumirror/jsnow$ bzr commit -m "Merge branch feature-set-config-and-log-files-from-command-line" |
52 | 7 | Daniel Dehennin | ftp@server:~/src/bzr-ubumirror/jsnow$ cd |
53 | 7 | Daniel Dehennin | </pre> |
54 | 7 | Daniel Dehennin | * Faire un lien symbolique pour l’installer |
55 | 7 | Daniel Dehennin | <pre> |
56 | 7 | Daniel Dehennin | ftp@server:~$ ln -s ~/src/bzr-ubumirror/jsnow/ubuarchive ~/bin/ubuarchive |
57 | 7 | Daniel Dehennin | </pre> |
58 | 7 | Daniel Dehennin | |
59 | 7 | Daniel Dehennin | Un tâche cron permet une synchronisation régulière, par exemple : |
60 | 7 | Daniel Dehennin | |
61 | 7 | Daniel Dehennin | <pre> |
62 | 7 | Daniel Dehennin | root@server:~$ crontab -u ftp -l |
63 | 7 | Daniel Dehennin | PATH=${HOME}/bin:${PATH} |
64 | 7 | Daniel Dehennin | 15 3 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/test.conf |
65 | 7 | Daniel Dehennin | </pre> |
66 | 7 | Daniel Dehennin | |
67 | 7 | Daniel Dehennin | En environnement nécessitant un mandataire HTTP, il est nécessaire d’exporter la variable *@RSYNC_PROXY@* : |
68 | 7 | Daniel Dehennin | |
69 | 7 | Daniel Dehennin | * Utilisation d’un nom d’hôte |
70 | 7 | Daniel Dehennin | <pre> |
71 | 7 | Daniel Dehennin | RSYNC_PROXY=FQDN_PROXY:PORT |
72 | 7 | Daniel Dehennin | </pre> |
73 | 7 | Daniel Dehennin | * Utilisation d’une adresse IP |
74 | 7 | Daniel Dehennin | <pre> |
75 | 7 | Daniel Dehennin | RSYNC_PROXY=IP_PROXY:PORT |
76 | 7 | Daniel Dehennin | </pre> |
77 | 7 | Daniel Dehennin | |
78 | 7 | Daniel Dehennin | |
79 | 7 | Daniel Dehennin | h3. Miroir Ubuntu |
80 | 7 | Daniel Dehennin | |
81 | 7 | Daniel Dehennin | Nous synchroniserons le miroir une fois par jour, dans la nuit : |
82 | 7 | Daniel Dehennin | |
83 | 7 | Daniel Dehennin | <pre> |
84 | 7 | Daniel Dehennin | root@server:~$ crontab -u ftp -l |
85 | 7 | Daniel Dehennin | PATH=${HOME}/bin:${PATH} |
86 | 7 | Daniel Dehennin | 15 3 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/ubuntu.conf |
87 | 7 | Daniel Dehennin | </pre> |
88 | 7 | Daniel Dehennin | |
89 | 7 | Daniel Dehennin | |
90 | 7 | Daniel Dehennin | Vous pouvez baser votre configuration sur le modèle suivant : |
91 | 7 | Daniel Dehennin | |
92 | 7 | Daniel Dehennin | <pre> |
93 | 1 | Daniel Dehennin | # |
94 | 5 | Daniel Dehennin | # ubumirror.conf - configuration file for the ubumirror scripts. |
95 | 1 | Daniel Dehennin | # |
96 | 1 | Daniel Dehennin | |
97 | 1 | Daniel Dehennin | # Please set the variables below to fit your site. |
98 | 1 | Daniel Dehennin | # Which email address/user that will receive failure notices. |
99 | 1 | Daniel Dehennin | EMAIL=mirror-admin@exemple.net |
100 | 1 | Daniel Dehennin | |
101 | 1 | Daniel Dehennin | # Server's FQDN. |
102 | 1 | Daniel Dehennin | HOSTNAME=$(hostname -f) |
103 | 1 | Daniel Dehennin | |
104 | 1 | Daniel Dehennin | # Bandwidth limit for all mirror scripts - set to 0 for no limit. |
105 | 1 | Daniel Dehennin | SPEED=10240 |
106 | 1 | Daniel Dehennin | |
107 | 1 | Daniel Dehennin | # UBUARC_DIR is the destination for the base of the archive directory |
108 | 1 | Daniel Dehennin | # The script won't run if this variable isn't set |
109 | 1 | Daniel Dehennin | UBUARC_DIR="/home/ftp/mirror/ubuntu/" |
110 | 1 | Daniel Dehennin | |
111 | 1 | Daniel Dehennin | # LOGDIR is the destination directory of all the logs |
112 | 7 | Daniel Dehennin | LOGDIR="/home/ftp/log.d/ubuntu" |
113 | 1 | Daniel Dehennin | |
114 | 1 | Daniel Dehennin | # UBU{ARC,CDI,REL}_MIRROR is the rsync path in the form of host::directory/ of the |
115 | 1 | Daniel Dehennin | # upstream mirrors where the ubumirror scripts will mirror from. |
116 | 7 | Daniel Dehennin | #UBUARC_MIRROR=ftp.crihan.fr::ubuntu/ |
117 | 7 | Daniel Dehennin | UBUARC_MIRROR=rsync://ftp.lip6.fr/Ubuntu/archive/ |
118 | 1 | Daniel Dehennin | |
119 | 1 | Daniel Dehennin | # UBU{ARC,CDI,REL}_EXCLUDE is what things you want to exclude |
120 | 1 | Daniel Dehennin | UBUARC_EXCLUDE="\ |
121 | 1 | Daniel Dehennin | --exclude binary-powerpc/ --exclude binary-sparc/ \ |
122 | 1 | Daniel Dehennin | --exclude daily-installer-powerpc/ --exclude daily-installer-sparc/ \ |
123 | 1 | Daniel Dehennin | --exclude installer-powerpc/ --exclude installer-sparc/ \ |
124 | 1 | Daniel Dehennin | --exclude *_powerpc.deb --exclude *_powerpc.udeb \ |
125 | 1 | Daniel Dehennin | --exclude *_sparc.deb --exclude *_sparc.udeb \ |
126 | 1 | Daniel Dehennin | --exclude Contents-powerpc.gz --exclude Contents-sparc.gz \ |
127 | 1 | Daniel Dehennin | --exclude pool/local \ |
128 | 1 | Daniel Dehennin | " |
129 | 1 | Daniel Dehennin | </pre> |
130 | 1 | Daniel Dehennin | |
131 | 7 | Daniel Dehennin | h3. Miroir EOLE 2.4 et plus |
132 | 5 | Daniel Dehennin | |
133 | 5 | Daniel Dehennin | |
134 | 7 | Daniel Dehennin | Nous synchroniserons le miroir une fois par jour, dans la nuit : |
135 | 7 | Daniel Dehennin | |
136 | 7 | Daniel Dehennin | <pre> |
137 | 7 | Daniel Dehennin | root@server:~$ crontab -u ftp -l |
138 | 7 | Daniel Dehennin | PATH=${HOME}/bin:${PATH} |
139 | 7 | Daniel Dehennin | 30 5 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/eole.conf |
140 | 7 | Daniel Dehennin | </pre> |
141 | 7 | Daniel Dehennin | |
142 | 7 | Daniel Dehennin | |
143 | 5 | Daniel Dehennin | Vous pouvez baser votre configuration sur le modèle suivant : |
144 | 5 | Daniel Dehennin | <pre> |
145 | 5 | Daniel Dehennin | # |
146 | 5 | Daniel Dehennin | # ubumirror.conf - configuration file for the ubumirror scripts. |
147 | 5 | Daniel Dehennin | # |
148 | 5 | Daniel Dehennin | |
149 | 5 | Daniel Dehennin | # Please set the variables below to fit your site. |
150 | 5 | Daniel Dehennin | # Which email address/user that will receive failure notices. |
151 | 5 | Daniel Dehennin | EMAIL=mirror-admin@exemple.net |
152 | 5 | Daniel Dehennin | |
153 | 5 | Daniel Dehennin | # Server's FQDN. |
154 | 5 | Daniel Dehennin | HOSTNAME=$(hostname -f) |
155 | 5 | Daniel Dehennin | |
156 | 5 | Daniel Dehennin | # Bandwidth limit for all mirror scripts - set to 0 for no limit. |
157 | 5 | Daniel Dehennin | SPEED=10240 |
158 | 5 | Daniel Dehennin | |
159 | 5 | Daniel Dehennin | # UBUARC_DIR is the destination for the base of the archive directory |
160 | 5 | Daniel Dehennin | # The script won't run if this variable isn't set |
161 | 5 | Daniel Dehennin | UBUARC_DIR="/home/ftp/mirror/eole/" |
162 | 5 | Daniel Dehennin | |
163 | 5 | Daniel Dehennin | # LOGDIR is the destination directory of all the logs |
164 | 7 | Daniel Dehennin | LOGDIR="/home/ftp/log.d/eole" |
165 | 5 | Daniel Dehennin | |
166 | 5 | Daniel Dehennin | # UBU{ARC,CDI,REL}_MIRROR is the rsync path in the form of host::directory/ of the |
167 | 5 | Daniel Dehennin | # upstream mirrors where the ubumirror scripts will mirror from. |
168 | 5 | Daniel Dehennin | UBUARC_MIRROR=rsync://eole.ac-dijon.fr/eole/ |
169 | 5 | Daniel Dehennin | |
170 | 5 | Daniel Dehennin | |
171 | 5 | Daniel Dehennin | # UBU{ARC,CDI,REL}_EXCLUDE is what things you want to exclude |
172 | 5 | Daniel Dehennin | UBUARC_EXCLUDE="" |
173 | 5 | Daniel Dehennin | </pre> |
174 | 5 | Daniel Dehennin | |
175 | 7 | Daniel Dehennin | h3. Miroir Envole 4 et plus |
176 | 7 | Daniel Dehennin | |
177 | 7 | Daniel Dehennin | |
178 | 7 | Daniel Dehennin | Nous synchroniserons le miroir une fois par jour, dans la nuit : |
179 | 7 | Daniel Dehennin | |
180 | 5 | Daniel Dehennin | <pre> |
181 | 7 | Daniel Dehennin | root@server:~$ crontab -u ftp -l |
182 | 7 | Daniel Dehennin | PATH=${HOME}/bin:${PATH} |
183 | 7 | Daniel Dehennin | 30 6 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/envole.conf |
184 | 5 | Daniel Dehennin | </pre> |
185 | 7 | Daniel Dehennin | |
186 | 7 | Daniel Dehennin | |
187 | 7 | Daniel Dehennin | Vous pouvez baser votre configuration sur le modèle suivant : |
188 | 7 | Daniel Dehennin | |
189 | 7 | Daniel Dehennin | <pre> |
190 | 7 | Daniel Dehennin | # |
191 | 7 | Daniel Dehennin | # ubumirror.conf - configuration file for the ubumirror scripts. |
192 | 7 | Daniel Dehennin | # |
193 | 7 | Daniel Dehennin | |
194 | 7 | Daniel Dehennin | # Please set the variables below to fit your site. |
195 | 7 | Daniel Dehennin | # Which email address/user that will receive failure notices. |
196 | 7 | Daniel Dehennin | EMAIL=mirror-admin@exemple.net |
197 | 7 | Daniel Dehennin | |
198 | 7 | Daniel Dehennin | # Server's FQDN. |
199 | 7 | Daniel Dehennin | HOSTNAME=$(hostname -f) |
200 | 7 | Daniel Dehennin | |
201 | 7 | Daniel Dehennin | # Bandwidth limit for all mirror scripts - set to 0 for no limit. |
202 | 7 | Daniel Dehennin | SPEED=10240 |
203 | 7 | Daniel Dehennin | |
204 | 7 | Daniel Dehennin | # UBUARC_DIR is the destination for the base of the archive directory |
205 | 7 | Daniel Dehennin | # The script won't run if this variable isn't set |
206 | 7 | Daniel Dehennin | UBUARC_DIR="/home/ftp/mirror/envole/" |
207 | 7 | Daniel Dehennin | |
208 | 7 | Daniel Dehennin | # LOGDIR is the destination directory of all the logs |
209 | 7 | Daniel Dehennin | LOGDIR="/home/ftp/log.d/envole" |
210 | 7 | Daniel Dehennin | |
211 | 7 | Daniel Dehennin | # UBU{ARC,CDI,REL}_MIRROR is the rsync path in the form of host::directory/ of the |
212 | 7 | Daniel Dehennin | # upstream mirrors where the ubumirror scripts will mirror from. |
213 | 7 | Daniel Dehennin | UBUARC_MIRROR=rsync://eole.ac-dijon.fr/envole/ |
214 | 7 | Daniel Dehennin | |
215 | 7 | Daniel Dehennin | |
216 | 7 | Daniel Dehennin | # UBU{ARC,CDI,REL}_EXCLUDE is what things you want to exclude |
217 | 7 | Daniel Dehennin | UBUARC_EXCLUDE="" |
218 | 7 | Daniel Dehennin | </pre> |
219 | 7 | Daniel Dehennin | |
220 | 1 | Daniel Dehennin | |
221 | 1 | Daniel Dehennin | h2. Miroir EOLE 2.3 |
222 | 1 | Daniel Dehennin | |
223 | 1 | Daniel Dehennin | La récupération des paquets EOLE jusqu’à la version 2.3 se fait avec le script suivant : |
224 | 1 | Daniel Dehennin | |
225 | 1 | Daniel Dehennin | <pre> |
226 | 1 | Daniel Dehennin | #!/bin/bash |
227 | 1 | Daniel Dehennin | |
228 | 1 | Daniel Dehennin | set -e -u |
229 | 1 | Daniel Dehennin | |
230 | 1 | Daniel Dehennin | MIRROR_SRC="eoleng.ac-dijon.fr::eoleng" |
231 | 1 | Daniel Dehennin | MIRROR_DST="/home/ftp/mirror/eoleng" |
232 | 1 | Daniel Dehennin | MIRROR_LOG_DIR="/home/ftp/mirror/log.d/eoleng" |
233 | 1 | Daniel Dehennin | MIRROR_LOG_FILE="${MIRROR_LOG_DIR}/eole.log" |
234 | 1 | Daniel Dehennin | |
235 | 1 | Daniel Dehennin | RSYNC_OPTS="-v --force --recursive --times --perms --links --delete-after" |
236 | 1 | Daniel Dehennin | RSYNC_EXCLUDE="--exclude mini-dinstall --exclude *.changes" |
237 | 1 | Daniel Dehennin | |
238 | 1 | Daniel Dehennin | test -d "${MIRROR_LOG_DIR}" || mkdir -p "${MIRROR_LOG_DIR}" |
239 | 1 | Daniel Dehennin | savelog -t -n -r "${MIRROR_LOG_DIR}" "${MIRROR_LOG_FILE}" |
240 | 2 | Daniel Dehennin | |
241 | 2 | Daniel Dehennin | rsync ${RSYNC_OPTS} ${RSYNC_EXCLUDE} ${MIRROR_SRC} ${MIRROR_DST} | tee -a "${MIRROR_LOG_FILE}" |
242 | 2 | Daniel Dehennin | </pre> |
243 | 2 | Daniel Dehennin | |
244 | 1 | Daniel Dehennin | Vous pouvez ensuite planifier une tâche cron comme suit: |
245 | 1 | Daniel Dehennin | |
246 | 1 | Daniel Dehennin | <pre> |
247 | 1 | Daniel Dehennin | SHELL=/bin/bash |
248 | 1 | Daniel Dehennin | PATH=~/.bin:/usr/bin:/bin |
249 | 1 | Daniel Dehennin | MAILTO=mirror-admin@example.net |
250 | 1 | Daniel Dehennin | |
251 | 1 | Daniel Dehennin | 0 5 * * * mirror-eole.sh > /dev/null |
252 | 1 | Daniel Dehennin | </pre> |
253 | 1 | Daniel Dehennin | |
254 | 1 | Daniel Dehennin | h2. Publication de votre miroir |
255 | 1 | Daniel Dehennin | |
256 | 1 | Daniel Dehennin | Il ne vous reste plus qu’à configurer un service HTTP ou FTP afin de rendre votre miroir accessible. |