Modifications entre les versions 2 et 4 (s'étendant sur 2 versions)
Version 2 à la date du 2008-07-08 11:31:11
Taille: 8046
Commentaire: révision : 1ère passe
Version 4 à la date du 2008-11-30 18:29:26
Taille: 7471
Commentaire: première passe...
Texte supprimé. Texte ajouté.
Ligne 3: Ligne 3:
=== Utilisation === === Utilisation implicite (automatique) des miroirs ===
Ligne 5: Ligne 5:
On ne modifie plus les sources APT mais on intercepte les téléchargements au niveau du proxy transparent pour les rediriger vers le miroir local (cf [[Squid]]). Cela suppose bien sûr un miroir dans un parfait état et mis à jour tous les jours. Néanmoins, si on souhaitait tout de même un accès explicite au miroir il se ferait comme suit : On ne modifie plus les sources APT mais on intercepte les téléchargements au niveau du proxy transparent pour les rediriger vers le miroir local (cf [[Squid]]). La technique utilisée teste la présence du fichier dans le miroir et fonctionne donc même dans le cas où il y aurait un souci avec le miroir.

Néanmoins, si on souhaitait tout de même un accès explicite au miroir, voir la section suivante.

=== Utilisation explicite (manuelle) des miroirs ===
Ligne 11: Ligne 15:
deb http://mirror.vn.refer.org/debian/volatile etch/volatile main contrib non-free
Ligne 12: Ligne 17:
#deb http://mirror.vn.refer.org/debian/multimedia etch main
deb http://apt.auf.org/ etch auf
Ligne 22: Ligne 29:
deb http://apt.auf.org/ hardy auf
Ligne 34: Ligne 42:
 /* Parler du fait que j'utilise le paquet `debmirror` de Lenny => retrouver d'abord pourquoi... ;-) */  /* Parler du fait que j'utilise le paquet `debmirror` de Lenny => retrouver d'abord pourquoi... ;-) il me semble que c'est pour les .udeb de debian-installer... */
Ligne 51: Ligne 59:
gpg --keyserver hkp://wwwkeys.eu.pgp.net --recv-keys 2D230C5F # Debian
gpg --keyserver [hkp://wwwkeys.eu.pgp.net ] --recv-keys 437D05B5 # Ubuntu
Ligne 58: Ligne 63:
gpg --no-default-keyring --keyring trustedkeys.gpg --recv 1F41B907 # Christian Marillat (Debian-Multimedia) #gpg --no-default-keyring --keyring trustedkeys.gpg --recv 1F41B907 # Christian Marillat (Debian-Multimedia)
Ligne 65: Ligne 70:
==== Fichier `/usr/local/lib/srv-mirror-functions` : ====
{{{
==== Scripts : ====

 *
Fichier `/usr/local/sbin/srv-mirror-rfc` :
{{{#!shell
Ligne 68: Ligne 75:
[ "$(id -u)" = 0 ] && exec su -s /bin/bash mirror -c "\"$0" $@" [ "$(id -u)" = 0 ] && exec su -s /bin/bash mirror -c "\"$0\" $@"
Ligne 72: Ligne 79:
==== Fichier `/usr/local/lib/srv-mirror-functions` : ====
{{{

 *
Fichier `/usr/local/sbin/srv-mirror-debian` :
{{{#!shell
Ligne 75: Ligne 83:
function make_repository {
  root="$1" ; dir="$2" ; arch="$3" ; url="$4"
  mkdir -p "${root}/${dir}" || return -1
  pushd "${root}/${dir}" >/dev/null
  mkdir -p "pool" "source" "binary-${arch}"
  lftp -e "mirror -cepP ${url} pool ; quit"
  apt-ftparchive sources "pool" /dev/null "${dir}" | gzip -c9 > "source/Sources.gz"
  apt-ftparchive packages "pool" /dev/null "${dir}" | gzip -c9 > "binary-${arch}/Packages.gz"
  apt-ftparchive release "pool" | gzip -c9 > "Release.gz"
  #apt-ftparchive contents "pool" | gzip -c9 > "Contents-${arch}.gz"
  popd >/dev/null
  return 0
}
}}}
==== Fichier `/usr/local/sbin/srv-mirror-debian` : ====
{{{
#!/bin/bash
# Depends: debmirror
Ligne 93: Ligne 85:
. /usr/local/lib/srv-mirror-functions
Ligne 95: Ligne 86:
#OPT="--ignore-release-gpg --ignore-small-errors --ignore-missing-release"
OPT="--md5sums --verbose $@"
DIST="sarge"
OPT="--exclude=.*-dbg_.*.deb --exclude=.*-debug_.*.deb --include=.*.udeb $@"
Ligne 99: Ligne 88:
RELEASE="3.1"
DISTNAME="Sarge"
DIST="etch"
RELEASE="4.0"
DISTNAME="Etch"
Ligne 102: Ligne 92:
mkdir -p "${DIR}"

rsync -a --delete tech.vn.refer.org::debian-auf-vn/ "${DIR}/auf-vn/"
mkdir -p "${DIR}" || exit -1
Ligne 111: Ligne 99:
mkdir -p "${DIR}/security/.disk"
echo "updates/main updates/contrib updates/non-free" >"${DIR}/security/.disk/base_components"
echo "Debian GNU/Linux ${RELEASE} _${DISTNAME}_ - Security Updates ($(date +%Y%m%d))" >"${DIR}/security/.disk/info"
Ligne 115: Ligne 100:
# --getcontents
debmirror "${DIR}/marillat" \
        --host=ftp.nerim.net --method=ftp --root=/debian-marillat \
        --dist="${DIST}" \
debmirror "${DIR}/volatile" \
        --host=volatile.debian.org --method=http --root=/debian-volatile \
        --dist="${DIST}/volatile" \
        --section=main,contrib,non-free \
        --arch="${ARCH}" --nosource $OPT

debmirror "${DIR}/backports" \
        --host=www.backports.org --method=http --root=/debian \
        --dist="${DIST}-backports" \
Ligne 121: Ligne 111:
mkdir -p "${DIR}/marillat/.disk"
echo "main" >"${DIR}/marillat/.disk/base_components"
echo "Debian GNU/Linux ${RELEASE} _${DISTNAME}_ - Marillat collection ($(date +%Y%m%d))" >"${DIR}/marillat/.disk/info"
Ligne 125: Ligne 112:
make_repository "${DIR}/misc" "dists/${DIST}/auf/vpn" "${ARCH}" "http://rpv.auf.org/packages" #debmirror "${DIR}/multimedia" \
# --host=www.debian-multimedia.org --method=http --root=/ \
# --dist="${DIST}" \
# --section=main \
# --arch="${ARCH}" --nosource $OPT
Ligne 127: Ligne 118:
make_repository "${DIR}/misc" "dists/${DIST}/auf/voip" "${ARCH}" "http://voip.ca.auf.org/asterisk"

make_repository "${DIR}/misc" "dists/${DIST}/xen3" "${ARCH}" "http://packages.debianbase.de/${DIST}/${ARCH}/xen3"

# --getcontents
Ligne 133: Ligne 119:
        --host=ftp.fr.debian.org --method=http --root=/debian \         --host=ftp.debian.org --method=http --root=/debian \
Ligne 137: Ligne 123:
mkdir -p "${DIR}/archive/.disk"
echo "main contrib non-free" >"${DIR}/archive/.disk/base_components"
echo "Debian GNU/Linux ${RELEASE} _${DISTNAME}_ - Archive mirror ($(date +%Y%m%d))" >"${DIR}/archive/.disk/info"
Ligne 143: Ligne 126:
==== Fichier `/usr/local/sbin/srv-mirror-ubuntu` : ====
{{{

 *
Fichier `/usr/local/sbin/srv-mirror-ubuntu` :
{{{
Ligne 146: Ligne 130:
# Depends: debmirror rsync
Ligne 147: Ligne 132:
. /usr/local/lib/srv-mirror-functions
Ligne 149: Ligne 133:
#OPT="--ignore-release-gpg --ignore-small-errors --ignore-missing-release"
OPT="--md5sums --verbose $@"
DIST="breezy"
OPT="--exclude=.*-dbg_.*.deb --exclude=.*-debug_.*.deb --include=.*.udeb $@"
Ligne 153: Ligne 135:
RELEASE="5.10"
DISTNAME="Breezy Badger"
LTSDIST="hardy" ; OLDDIST="feisty" ; DIST="gutsy" ; NEWDIST="intrepid"
LTSRELEASE="8.04" ; OLDRELEASE="7.04" ; RELEASE="7.10" ; NEWRELEASE="8.10"
LTSDISTNAME="Hardy Heron" ; OLDDISTNAME="Feisty Fawn" ; DISTNAME="Gutsy Gibbon" ; NEWDISTNAME="Intrepid Ibex"
Ligne 156: Ligne 139:
mkdir -p "${DIR}"

rsync -a --delete tech.vn.refer.org::ubuntu-auf-vn/ "${DIR}/auf-vn/"
mkdir -p "${DIR}" || exit -1
Ligne 162: Ligne 143:
        --dist="${DIST}-security" \         --dist="${LTSDIST}-security","${OLDDIST}-security","${DIST}-security","${NEWDIST}-security" \
Ligne 164: Ligne 145:
        --arch="${ARCH}" --nosource $OPT
mkdir -p "${DIR}/security/.disk"
echo "main retricted universe multiverse" >"${DIR}/security/.disk/base_components"
echo "Ubuntu ${RELEASE} _${DISTNAME}_ - Security Updates ($(date +%Y%m%d))" >"${DIR}/security/.disk/info"
        --arch="${ARCH}" --nosource ${OPT}
Ligne 169: Ligne 147:
make_repository "${DIR}/misc" "dists/${DIST}/ooo2" "${ARCH}" "http://people.ubuntu.com/~doko/OOo2" debmirror "${DIR}/medibuntu" \
        --host=packages.medibuntu.org --method=http --root=/ \
        --dist="${LTSDIST}","${DIST}" \
        --section=free,non-free \
        --arch="${ARCH}" --nosource ${OPT}

debmirror "${DIR}/hanoilug" \
        --host=apt.hanoilug.org --method=http --root=/ubuntu \
        --dist="${LTSDIST}","${DIST}","${NEWDIST}" \
        --section=contrib,import,experimental \
        --arch="${ARCH}" --nosource ${OPT}
Ligne 172: Ligne 160:
        --host=vn.archive.ubuntu.com --method=http --root=/ubuntu \
        --dist="${DIST},${DIST}-updates,${DIST}-backports" \
        --section=main,restricted,universe,multiverse \
        --arch="${ARCH}" --nosource $OPT
        --host=archive.ubuntu.com --method=http --root=/ubuntu \
        --dist="${LTSDIST}-updates,${DIST}-updates,${OLDDIST}-updates,${LTSDIST}-backports,${DIST}-backports,${LTSDIST},${DIST},${NEWDIST}-updates,${NEWDIST}-backports,${NEWDIST}" \
        --section=main,restricted,universe,multiverse,main/debian-installer,restricted/debian-installer \
        --arch="${ARCH}" --nosource ${OPT}
Ligne 178: Ligne 166:
}}}
Ligne 179: Ligne 168:
# main + restricted = 2,7 Go au 06/11/2005
# main + restricted + universe = 10,2 Go au 07/11/2005
}}}
====
Fichier `/etc/cron.d/srv-mirror` : ====
{{{
MAILTO=technique-logs@vn.auf.org
 * Fichier `/etc/cron.d/srv-mirror` :
{{{
MAILTO=technique-log!vn.refer.org
Ligne 186: Ligne 172:
#30 1 * * * mirror /usr/local/sbin/srv-mirror-auf 2>&1 &

Cette page présente le modèle des miroirs mis en place au CNF de Hanoï.

Utilisation implicite (automatique) des miroirs

On ne modifie plus les sources APT mais on intercepte les téléchargements au niveau du proxy transparent pour les rediriger vers le miroir local (cf Squid). La technique utilisée teste la présence du fichier dans le miroir et fonctionne donc même dans le cas où il y aurait un souci avec le miroir.

Néanmoins, si on souhaitait tout de même un accès explicite au miroir, voir la section suivante.

Utilisation explicite (manuelle) des miroirs

  • pour Debian GNU/Linux "Etch" 4.0 :

    deb http://mirror.vn.refer.org/debian/archive etch main contrib non-free
    deb http://mirror.vn.refer.org/debian/security etch/updates main contrib non-free
    deb http://mirror.vn.refer.org/debian/volatile etch/volatile main contrib non-free
    deb http://mirror.vn.refer.org/debian/backports etch-backports main
    #deb http://mirror.vn.refer.org/debian/multimedia etch main
    deb http://apt.auf.org/ etch auf
  • pour Ubuntu Linux "Hardy Heron" 8.04.1 (LTS) :

    deb http://mirror.vn.refer.org/ubuntu/archive hardy main restricted universe multiverse
    deb http://mirror.vn.refer.org/ubuntu/archive hardy-updates main restricted universe multiverse
    deb http://mirror.vn.refer.org/ubuntu/archive hardy-backports main restricted universe multiverse
    deb http://mirror.vn.refer.org/ubuntu/security hardy-security main restricted universe multiverse
    deb http://mirror.vn.refer.org/ubuntu/medibuntu hardy free non-free
    deb http://mirror.vn.refer.org/ubuntu/hanoilug hardy contrib import # experimental
    deb http://apt.auf.org/ hardy auf

{i} Tout (ou presque) est également accessible via rsync mirror.vn.refer.org::

Mise en place

Pré-requis :

  • ces scripts utilisent des outils externes qui doivent donc être installés :
    sudo aptitude install debmirror gnupg rsync lftp apt-utils

  • les miroirs sont fait par un utilisateur dédié mirror qui doit donc être créé :

    sudo useradd -s /bin/false -m mirror
  • les miroirs sont installés dans le répertoire /srv/mirror/ qui doit donc être créé :

    sudo mkdir /srv/mirror
    sudo chown mirror /srv/mirror
  • le compte mirror doit posséder une copie des clés publiques de signature des archives :

    sudo -u mirror /bin/sh
    mkdir .gnupg
    tail +4 /usr/share/gnupg/options.skel > .gnupg/gpg.conf
    
    gpg --no-default-keyring --keyring trustedkeys.gpg --recv ADB11277 # Etch Stable Release Key
    gpg --no-default-keyring --keyring trustedkeys.gpg --recv A70DAF536070D3A1 # Debian Archive Automatic Signing Key (4.0/etch)
    gpg --no-default-keyring --keyring trustedkeys.gpg --recv EC61E0B0BBE55AB3 # Debian-Volatile Archive Automatic Signing Key (4.0/etch)
    gpg --no-default-keyring --keyring trustedkeys.gpg --recv EA8E8B2116BA136C # Backports.org Archive Key
    #gpg --no-default-keyring --keyring trustedkeys.gpg --recv 1F41B907 # Christian Marillat (Debian-Multimedia)
    
    gpg --no-default-keyring --keyring trustedkeys.gpg --recv 40976EAF437D05B5 # Ubuntu Archive Automatic Signing Key
    gpg --no-default-keyring --keyring trustedkeys.gpg --recv 2EBC26B60C5A2783 # Medibuntu Packaging Team
    gpg --no-default-keyring --keyring trustedkeys.gpg --recv 735B04432B7ADF77 # Jean Christophe ANDRÉ (HanoiLUG)

Scripts :

  • Fichier /usr/local/sbin/srv-mirror-rfc :

    #!/bin/bash
    [ "$(id -u)" = 0 ] && exec su -s /bin/bash mirror -c "\"$0\" $@"
    DIR="/srv/mirror/rfc"
    exec lftp -e "mirror -cepvP /pub/rfc/rfc ${DIR} ; quit" ftp.lip6.fr
  • Fichier /usr/local/sbin/srv-mirror-debian :

    #!/bin/bash
    # Depends: debmirror
    [ "$(id -u)" = 0 ] && exec su -s /bin/bash mirror -c "\"$0\" $@"
    DIR="/srv/mirror/debian"
    OPT="--exclude=.*-dbg_.*.deb --exclude=.*-debug_.*.deb --include=.*.udeb $@"
    ARCH="i386"
    DIST="etch"
    RELEASE="4.0"
    DISTNAME="Etch"
    
    mkdir -p "${DIR}" || exit -1
    
    debmirror "${DIR}/security" \
            --host=security.debian.org --method=http --root=/debian-security \
            --dist="${DIST}/updates" \
            --section=main,contrib,non-free \
            --arch="${ARCH}" --nosource $OPT
    
    debmirror "${DIR}/volatile" \
            --host=volatile.debian.org --method=http --root=/debian-volatile \
            --dist="${DIST}/volatile" \
            --section=main,contrib,non-free \
            --arch="${ARCH}" --nosource $OPT
    
    debmirror "${DIR}/backports" \
            --host=www.backports.org --method=http --root=/debian \
            --dist="${DIST}-backports" \
            --section=main \
            --arch="${ARCH}" --nosource $OPT
    
    #debmirror "${DIR}/multimedia" \
    #        --host=www.debian-multimedia.org --method=http --root=/ \
    #        --dist="${DIST}" \
    #        --section=main \
    #        --arch="${ARCH}" --nosource $OPT
    
    debmirror "${DIR}/archive" \
            --host=ftp.debian.org --method=http --root=/debian \
            --dist="${DIST}" \
            --section=main,contrib,non-free,main/debian-installer \
            --arch="${ARCH}" --nosource $OPT
    
    exit 0
  • Fichier /usr/local/sbin/srv-mirror-ubuntu :

    # Depends: debmirror rsync
    [ "$(id -u)" = 0 ] && exec su -s /bin/bash mirror -c "\"$0\" $@"
    DIR="/srv/mirror/ubuntu"
    OPT="--exclude=.*-dbg_.*.deb --exclude=.*-debug_.*.deb --include=.*.udeb $@"
    ARCH="i386"
    LTSDIST="hardy"           ; OLDDIST="feisty"          ; DIST="gutsy"            ; NEWDIST="intrepid"
    LTSRELEASE="8.04"         ; OLDRELEASE="7.04"         ; RELEASE="7.10"          ; NEWRELEASE="8.10"
    LTSDISTNAME="Hardy Heron" ; OLDDISTNAME="Feisty Fawn" ; DISTNAME="Gutsy Gibbon" ; NEWDISTNAME="Intrepid Ibex"
    
    mkdir -p "${DIR}" || exit -1
    
    debmirror "${DIR}/security" \
            --host=security.ubuntu.com --method=http --root=/ubuntu \
            --dist="${LTSDIST}-security","${OLDDIST}-security","${DIST}-security","${NEWDIST}-security" \
            --section=main,restricted,universe,multiverse \
            --arch="${ARCH}" --nosource ${OPT}
    
    debmirror "${DIR}/medibuntu" \
            --host=packages.medibuntu.org --method=http --root=/ \
            --dist="${LTSDIST}","${DIST}" \
            --section=free,non-free \
            --arch="${ARCH}" --nosource ${OPT}
    
    debmirror "${DIR}/hanoilug" \
            --host=apt.hanoilug.org --method=http --root=/ubuntu \
            --dist="${LTSDIST}","${DIST}","${NEWDIST}" \
            --section=contrib,import,experimental \
            --arch="${ARCH}" --nosource ${OPT}
    
    debmirror "${DIR}/archive" \
            --host=archive.ubuntu.com --method=http --root=/ubuntu \
            --dist="${LTSDIST}-updates,${DIST}-updates,${OLDDIST}-updates,${LTSDIST}-backports,${DIST}-backports,${LTSDIST},${DIST},${NEWDIST}-updates,${NEWDIST}-backports,${NEWDIST}" \
            --section=main,restricted,universe,multiverse,main/debian-installer,restricted/debian-installer \
            --arch="${ARCH}" --nosource ${OPT}
    
    exit 0
  • Fichier /etc/cron.d/srv-mirror :

    MAILTO=technique-log!vn.refer.org
    0  1 * * * mirror /usr/local/sbin/srv-mirror-rfc 2>&1 &
    #30 1 * * * mirror /usr/local/sbin/srv-mirror-auf 2>&1 &
    0  2 * * * mirror /usr/local/sbin/srv-mirror-debian 2>&1 &
    0  3 * * * mirror /usr/local/sbin/srv-mirror-ubuntu 2>&1 &

ZAP/Configuration/Miroir (dernière édition le 2008-11-30 18:29:26 par JeanChristopheAndré)