MiroirEOLE » Historique » Version 9
Daniel Dehennin, 01/06/2016 15:25
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 | h3. Miroir Ubuntu |
79 | 7 | Daniel Dehennin | |
80 | 7 | Daniel Dehennin | Nous synchroniserons le miroir une fois par jour, dans la nuit : |
81 | 7 | Daniel Dehennin | |
82 | 7 | Daniel Dehennin | <pre> |
83 | 7 | Daniel Dehennin | root@server:~$ crontab -u ftp -l |
84 | 7 | Daniel Dehennin | PATH=${HOME}/bin:${PATH} |
85 | 7 | Daniel Dehennin | 15 3 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/ubuntu.conf |
86 | 7 | Daniel Dehennin | </pre> |
87 | 7 | Daniel Dehennin | |
88 | 1 | Daniel Dehennin | |
89 | 9 | Daniel Dehennin | Vous pouvez baser votre configuration sur le modèle suivant en choisisant le "miroir rsync":https://launchpad.net/ubuntu/+archivemirrors à votre convenance : |
90 | 7 | Daniel Dehennin | |
91 | 7 | Daniel Dehennin | <pre> |
92 | 1 | Daniel Dehennin | # |
93 | 5 | Daniel Dehennin | # ubumirror.conf - configuration file for the ubumirror scripts. |
94 | 1 | Daniel Dehennin | # |
95 | 1 | Daniel Dehennin | |
96 | 1 | Daniel Dehennin | # Please set the variables below to fit your site. |
97 | 1 | Daniel Dehennin | # Which email address/user that will receive failure notices. |
98 | 1 | Daniel Dehennin | EMAIL=mirror-admin@exemple.net |
99 | 1 | Daniel Dehennin | |
100 | 1 | Daniel Dehennin | # Server's FQDN. |
101 | 1 | Daniel Dehennin | HOSTNAME=$(hostname -f) |
102 | 1 | Daniel Dehennin | |
103 | 1 | Daniel Dehennin | # Bandwidth limit for all mirror scripts - set to 0 for no limit. |
104 | 1 | Daniel Dehennin | SPEED=10240 |
105 | 1 | Daniel Dehennin | |
106 | 1 | Daniel Dehennin | # UBUARC_DIR is the destination for the base of the archive directory |
107 | 1 | Daniel Dehennin | # The script won't run if this variable isn't set |
108 | 1 | Daniel Dehennin | UBUARC_DIR="/home/ftp/mirror/ubuntu/" |
109 | 1 | Daniel Dehennin | |
110 | 1 | Daniel Dehennin | # LOGDIR is the destination directory of all the logs |
111 | 7 | Daniel Dehennin | LOGDIR="/home/ftp/log.d/ubuntu" |
112 | 1 | Daniel Dehennin | |
113 | 1 | Daniel Dehennin | # UBU{ARC,CDI,REL}_MIRROR is the rsync path in the form of host::directory/ of the |
114 | 1 | Daniel Dehennin | # upstream mirrors where the ubumirror scripts will mirror from. |
115 | 7 | Daniel Dehennin | #UBUARC_MIRROR=ftp.crihan.fr::ubuntu/ |
116 | 7 | Daniel Dehennin | UBUARC_MIRROR=rsync://ftp.lip6.fr/Ubuntu/archive/ |
117 | 1 | Daniel Dehennin | |
118 | 1 | Daniel Dehennin | # UBU{ARC,CDI,REL}_EXCLUDE is what things you want to exclude |
119 | 1 | Daniel Dehennin | UBUARC_EXCLUDE="\ |
120 | 1 | Daniel Dehennin | --exclude binary-powerpc/ --exclude binary-sparc/ \ |
121 | 1 | Daniel Dehennin | --exclude daily-installer-powerpc/ --exclude daily-installer-sparc/ \ |
122 | 1 | Daniel Dehennin | --exclude installer-powerpc/ --exclude installer-sparc/ \ |
123 | 1 | Daniel Dehennin | --exclude *_powerpc.deb --exclude *_powerpc.udeb \ |
124 | 1 | Daniel Dehennin | --exclude *_sparc.deb --exclude *_sparc.udeb \ |
125 | 1 | Daniel Dehennin | --exclude Contents-powerpc.gz --exclude Contents-sparc.gz \ |
126 | 1 | Daniel Dehennin | --exclude pool/local \ |
127 | 1 | Daniel Dehennin | " |
128 | 1 | Daniel Dehennin | </pre> |
129 | 1 | Daniel Dehennin | |
130 | 7 | Daniel Dehennin | h3. Miroir EOLE 2.4 et plus |
131 | 5 | Daniel Dehennin | |
132 | 5 | Daniel Dehennin | |
133 | 7 | Daniel Dehennin | Nous synchroniserons le miroir une fois par jour, dans la nuit : |
134 | 7 | Daniel Dehennin | |
135 | 7 | Daniel Dehennin | <pre> |
136 | 7 | Daniel Dehennin | root@server:~$ crontab -u ftp -l |
137 | 7 | Daniel Dehennin | PATH=${HOME}/bin:${PATH} |
138 | 7 | Daniel Dehennin | 30 5 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/eole.conf |
139 | 7 | Daniel Dehennin | </pre> |
140 | 7 | Daniel Dehennin | |
141 | 7 | Daniel Dehennin | |
142 | 5 | Daniel Dehennin | Vous pouvez baser votre configuration sur le modèle suivant : |
143 | 5 | Daniel Dehennin | <pre> |
144 | 5 | Daniel Dehennin | # |
145 | 5 | Daniel Dehennin | # ubumirror.conf - configuration file for the ubumirror scripts. |
146 | 5 | Daniel Dehennin | # |
147 | 5 | Daniel Dehennin | |
148 | 5 | Daniel Dehennin | # Please set the variables below to fit your site. |
149 | 5 | Daniel Dehennin | # Which email address/user that will receive failure notices. |
150 | 5 | Daniel Dehennin | EMAIL=mirror-admin@exemple.net |
151 | 5 | Daniel Dehennin | |
152 | 5 | Daniel Dehennin | # Server's FQDN. |
153 | 5 | Daniel Dehennin | HOSTNAME=$(hostname -f) |
154 | 5 | Daniel Dehennin | |
155 | 5 | Daniel Dehennin | # Bandwidth limit for all mirror scripts - set to 0 for no limit. |
156 | 5 | Daniel Dehennin | SPEED=10240 |
157 | 5 | Daniel Dehennin | |
158 | 5 | Daniel Dehennin | # UBUARC_DIR is the destination for the base of the archive directory |
159 | 5 | Daniel Dehennin | # The script won't run if this variable isn't set |
160 | 5 | Daniel Dehennin | UBUARC_DIR="/home/ftp/mirror/eole/" |
161 | 5 | Daniel Dehennin | |
162 | 5 | Daniel Dehennin | # LOGDIR is the destination directory of all the logs |
163 | 7 | Daniel Dehennin | LOGDIR="/home/ftp/log.d/eole" |
164 | 5 | Daniel Dehennin | |
165 | 5 | Daniel Dehennin | # UBU{ARC,CDI,REL}_MIRROR is the rsync path in the form of host::directory/ of the |
166 | 5 | Daniel Dehennin | # upstream mirrors where the ubumirror scripts will mirror from. |
167 | 5 | Daniel Dehennin | UBUARC_MIRROR=rsync://eole.ac-dijon.fr/eole/ |
168 | 5 | Daniel Dehennin | |
169 | 5 | Daniel Dehennin | |
170 | 5 | Daniel Dehennin | # UBU{ARC,CDI,REL}_EXCLUDE is what things you want to exclude |
171 | 5 | Daniel Dehennin | UBUARC_EXCLUDE="" |
172 | 5 | Daniel Dehennin | </pre> |
173 | 5 | Daniel Dehennin | |
174 | 7 | Daniel Dehennin | h3. Miroir Envole 4 et plus |
175 | 7 | Daniel Dehennin | |
176 | 7 | Daniel Dehennin | |
177 | 7 | Daniel Dehennin | Nous synchroniserons le miroir une fois par jour, dans la nuit : |
178 | 7 | Daniel Dehennin | |
179 | 5 | Daniel Dehennin | <pre> |
180 | 7 | Daniel Dehennin | root@server:~$ crontab -u ftp -l |
181 | 7 | Daniel Dehennin | PATH=${HOME}/bin:${PATH} |
182 | 7 | Daniel Dehennin | 30 6 * * * ${HOME}/bin/ubuarchive --conf ${HOME}/.config/ubumirror/envole.conf |
183 | 5 | Daniel Dehennin | </pre> |
184 | 7 | Daniel Dehennin | |
185 | 7 | Daniel Dehennin | |
186 | 7 | Daniel Dehennin | Vous pouvez baser votre configuration sur le modèle suivant : |
187 | 7 | Daniel Dehennin | |
188 | 7 | Daniel Dehennin | <pre> |
189 | 7 | Daniel Dehennin | # |
190 | 7 | Daniel Dehennin | # ubumirror.conf - configuration file for the ubumirror scripts. |
191 | 7 | Daniel Dehennin | # |
192 | 7 | Daniel Dehennin | |
193 | 7 | Daniel Dehennin | # Please set the variables below to fit your site. |
194 | 7 | Daniel Dehennin | # Which email address/user that will receive failure notices. |
195 | 7 | Daniel Dehennin | EMAIL=mirror-admin@exemple.net |
196 | 7 | Daniel Dehennin | |
197 | 7 | Daniel Dehennin | # Server's FQDN. |
198 | 7 | Daniel Dehennin | HOSTNAME=$(hostname -f) |
199 | 7 | Daniel Dehennin | |
200 | 7 | Daniel Dehennin | # Bandwidth limit for all mirror scripts - set to 0 for no limit. |
201 | 7 | Daniel Dehennin | SPEED=10240 |
202 | 7 | Daniel Dehennin | |
203 | 7 | Daniel Dehennin | # UBUARC_DIR is the destination for the base of the archive directory |
204 | 7 | Daniel Dehennin | # The script won't run if this variable isn't set |
205 | 7 | Daniel Dehennin | UBUARC_DIR="/home/ftp/mirror/envole/" |
206 | 7 | Daniel Dehennin | |
207 | 7 | Daniel Dehennin | # LOGDIR is the destination directory of all the logs |
208 | 7 | Daniel Dehennin | LOGDIR="/home/ftp/log.d/envole" |
209 | 7 | Daniel Dehennin | |
210 | 7 | Daniel Dehennin | # UBU{ARC,CDI,REL}_MIRROR is the rsync path in the form of host::directory/ of the |
211 | 7 | Daniel Dehennin | # upstream mirrors where the ubumirror scripts will mirror from. |
212 | 7 | Daniel Dehennin | UBUARC_MIRROR=rsync://eole.ac-dijon.fr/envole/ |
213 | 7 | Daniel Dehennin | |
214 | 7 | Daniel Dehennin | |
215 | 7 | Daniel Dehennin | # UBU{ARC,CDI,REL}_EXCLUDE is what things you want to exclude |
216 | 7 | Daniel Dehennin | UBUARC_EXCLUDE="" |
217 | 7 | Daniel Dehennin | </pre> |
218 | 7 | Daniel Dehennin | |
219 | 1 | Daniel Dehennin | |
220 | 1 | Daniel Dehennin | h2. Miroir EOLE 2.3 |
221 | 1 | Daniel Dehennin | |
222 | 1 | Daniel Dehennin | La récupération des paquets EOLE jusqu’à la version 2.3 se fait avec le script suivant : |
223 | 1 | Daniel Dehennin | |
224 | 1 | Daniel Dehennin | <pre> |
225 | 1 | Daniel Dehennin | #!/bin/bash |
226 | 1 | Daniel Dehennin | |
227 | 1 | Daniel Dehennin | set -e -u |
228 | 1 | Daniel Dehennin | |
229 | 1 | Daniel Dehennin | MIRROR_SRC="eoleng.ac-dijon.fr::eoleng" |
230 | 1 | Daniel Dehennin | MIRROR_DST="/home/ftp/mirror/eoleng" |
231 | 1 | Daniel Dehennin | MIRROR_LOG_DIR="/home/ftp/mirror/log.d/eoleng" |
232 | 1 | Daniel Dehennin | MIRROR_LOG_FILE="${MIRROR_LOG_DIR}/eole.log" |
233 | 1 | Daniel Dehennin | |
234 | 1 | Daniel Dehennin | RSYNC_OPTS="-v --force --recursive --times --perms --links --delete-after" |
235 | 1 | Daniel Dehennin | RSYNC_EXCLUDE="--exclude mini-dinstall --exclude *.changes" |
236 | 1 | Daniel Dehennin | |
237 | 1 | Daniel Dehennin | test -d "${MIRROR_LOG_DIR}" || mkdir -p "${MIRROR_LOG_DIR}" |
238 | 1 | Daniel Dehennin | savelog -t -n -r "${MIRROR_LOG_DIR}" "${MIRROR_LOG_FILE}" |
239 | 2 | Daniel Dehennin | |
240 | 2 | Daniel Dehennin | rsync ${RSYNC_OPTS} ${RSYNC_EXCLUDE} ${MIRROR_SRC} ${MIRROR_DST} | tee -a "${MIRROR_LOG_FILE}" |
241 | 2 | Daniel Dehennin | </pre> |
242 | 2 | Daniel Dehennin | |
243 | 1 | Daniel Dehennin | Vous pouvez ensuite planifier une tâche cron comme suit: |
244 | 1 | Daniel Dehennin | |
245 | 1 | Daniel Dehennin | <pre> |
246 | 1 | Daniel Dehennin | SHELL=/bin/bash |
247 | 1 | Daniel Dehennin | PATH=~/.bin:/usr/bin:/bin |
248 | 1 | Daniel Dehennin | MAILTO=mirror-admin@example.net |
249 | 1 | Daniel Dehennin | |
250 | 1 | Daniel Dehennin | 0 5 * * * mirror-eole.sh > /dev/null |
251 | 1 | Daniel Dehennin | </pre> |
252 | 1 | Daniel Dehennin | |
253 | 1 | Daniel Dehennin | h2. Publication de votre miroir |
254 | 1 | Daniel Dehennin | |
255 | 1 | Daniel Dehennin | Il ne vous reste plus qu’à configurer un service HTTP ou FTP afin de rendre votre miroir accessible. |