Modifications entre les versions 2 et 3
Version 2 à la date du 2008-07-08 11:31:11
Taille: 8046
Commentaire: révision : 1ère passe
Version 3 à la date du 2008-07-08 12:05:01
Taille: 8104
Commentaire: révision : 2nde passe
Texte supprimé. Texte ajouté.
Ligne 11: Ligne 11:
deb http://mirror.vn.refer.org/debian/volatile etch/volatile main contrib non-free
Ligne 12: Ligne 13:
#deb http://mirror.vn.refer.org/debian/multimedia etch main
Ligne 51: Ligne 53:
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 57:
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 64:
==== Fichier `/usr/local/lib/srv-mirror-functions` : ====
{{{
#!/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/lib/srv-mirror-functions` : ====
{{{
==== Scripts : ====

 * Fichier `/usr/local/lib/srv-mirror-functions` '''(obsolète)''' :
 {{{
Ligne 76: Ligne 70:
  root="$1" ; dir="$2" ; arch="$3" ; url="$4"   root="$1" ; dist="$2" ; component="$3" ; arch="$4" ; url="$5"
  dir="dists/${dist}/${component}"
Ligne 80: Ligne 75:
  lftp -e "mirror -cepP ${url} pool ; quit"   lftp -e "set net:no-proxy . ; mirror -cepP ${url} pool ; quit"
Ligne 83: Ligne 78:
  cat > "binary-${arch}/Release" << __EOF__
Archive: stable
Version: (unspecified)
Component: ${component}
Origin: AuF-ZAP
Label: Mirror
Architecture: ${arch}
__EOF__
Ligne 89: Ligne 92:
==== Fichier `/usr/local/sbin/srv-mirror-debian` : ====
{{{

 *
Fichier `/usr/local/sbin/srv-mirror-rfc` :
{{{
Ligne 93: Ligne 97:
. /usr/local/lib/srv-mirror-functions 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\" $@"
Ligne 95: Ligne 107:
#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 109:
RELEASE="3.1"
DISTNAME="Sarge"
DIST="etch"
RELEASE="4.0"
DISTNAME="Etch"
Ligne 102: Ligne 113:
mkdir -p "${DIR}"

rsync -a --delete tech.vn.refer.org::debian-auf-vn/ "${DIR}/auf-vn/"
mkdir -p "${DIR}" || exit -1
Ligne 111: Ligne 120:
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 121:
# --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 132:
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 133:
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 139:
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 140:
        --host=ftp.fr.debian.org --method=http --root=/debian \         --host=ftp.debian.org --method=http --root=/debian \
Ligne 137: Ligne 144:
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 147:
==== Fichier `/usr/local/sbin/srv-mirror-ubuntu` : ====
{{{

 *
Fichier `/usr/local/sbin/srv-mirror-ubuntu` :
{{{
Ligne 146: Ligne 151:
# Depends: debmirror rsync
Ligne 147: Ligne 153:
. /usr/local/lib/srv-mirror-functions
Ligne 149: Ligne 154:
#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 156:
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 160:
mkdir -p "${DIR}"

rsync -a --delete tech.vn.refer.org::ubuntu-auf-vn/ "${DIR}/auf-vn/"
mkdir -p "${DIR}" || exit -1
Ligne 162: Ligne 164:
        --dist="${DIST}-security" \         --dist="${LTSDIST}-security","${OLDDIST}-security","${DIST}-security","${NEWDIST}-security" \
Ligne 164: Ligne 166:
        --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 168:
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 181:
        --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 187:
}}}
Ligne 179: Ligne 189:
# 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 193:
#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

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 :

  • 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
  • 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

{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/lib/srv-mirror-functions (obsolète) :

    function make_repository {
      root="$1" ; dist="$2" ; component="$3" ; arch="$4" ; url="$5"
      dir="dists/${dist}/${component}"
      mkdir -p "${root}/${dir}" || return -1
      pushd "${root}/${dir}" >/dev/null
      mkdir -p "pool" "source" "binary-${arch}"
      lftp -e "set net:no-proxy . ; 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"
      cat > "binary-${arch}/Release" << __EOF__
    Archive: stable
    Version: (unspecified)
    Component: ${component}
    Origin: AuF-ZAP
    Label: Mirror
    Architecture: ${arch}
    __EOF__
      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-rfc :

    [ "$(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 :

    # 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é)