**!!! ACHTUNG - evtl. veraltet - ACHTUNG !!!**
Diese Seite wurde zuletzt am 9. Juli 2014 um 08:47 Uhr geändert.
Installation:
aptitude install apt-mirror nginx
Weil cron in all meinen VServern komischer Weise per default nicht beim starten des VServers mitgestartet wurde:
update-rc.d cron defaults
/etc/apt/mirror.list:
############# config ##################
#
set nthreads 20
set _tilde 0
#
############# end config ##############
### LENNY, SQUEEZE,... ###
deb-amd64 http://ftp2.de.debian.org/debian lenny main contrib non-free
deb-i386 http://ftp2.de.debian.org/debian lenny main contrib non-free
### DEBIAN-VOLATILE ###
deb-amd64 http://volatile.debian.org/debian-volatile lenny/volatile main contrib non-free
deb-i386 http://volatile.debian.org/debian-volatile lenny/volatile main contrib non-free
### DEBIAN-SECURITY ###
deb-amd64 http://security.debian.org lenny/updates main contrib non-free
deb-i386 http://security.debian.org lenny/updates main contrib non-free
### LENNY-BACKPORTS ###
deb-amd64 http://www.backports.org/debian lenny-backports main contrib non-free
deb-i386 http://www.backports.org/debian lenny-backports main contrib non-free
### www.DEBIAN-MULTIMEDIA.org ###
deb-amd64 http://ftp.sunet.se/pub/os/Linux/distributions/Debian/debian-multimedia lenny main
deb-i386 http://ftp.sunet.se/pub/os/Linux/distributions/Debian/debian-multimedia lenny main
### DRBL.sourceforge.net ###
deb-amd64 http://drbl.sourceforge.net/drbl-core drbl stable
deb-i386 http://drbl.sourceforge.net/drbl-core drbl stable
clean http://ftp2.de.debian.org
clean http://security.debian.org
clean http://volatile.debian.org
clean http://www.backports.org
clean http://ftp.sunet.se
clean http://drbl.sourceforge.net
skip-clean http://ftp2.de.debian.org/debian/dists/lenny/main/debian-installer/binary-amd64/
skip-clean http://ftp2.de.debian.org/debian/dists/lenny/main/debian-installer/binary-i386/
skip-clean http://ftp2.de.debian.org/debian/dists/lenny/non-free/debian-installer/binary-amd64/
skip-clean http://ftp2.de.debian.org/debian/dists/lenny/non-free/debian-installer/binary-i386/
skip-clean http://ftp2.de.debian.org/debian/dists/lenny/main/i18n/
skip-clean http://ftp2.de.debian.org/debian/dists/lenny/main/i18n/
/etc/cron.daily/apt-mirror (Logging only):
#!/bin/bash
SU_C="/bin/su - apt-mirror -c"
AM_DIR="/var/spool/apt-mirror"
LOG_DIR="/var/log/apt-mirror"
LOG_FILE="cron.log"
LOG_PATH="$LOG_DIR/$LOG_FILE"
I18N_PATH="ftp2.de.debian.org/debian/dists/lenny/main/i18n"
I18N_FILE="Translation-de.gz"
# checks
if [[|! -d $LOG_DIR ]] ; then mkdir $LOG_DIR ; fi
if [[|-z "$( find ${LOG_DIR%/*} -maxdepth 1 -name ${LOG_DIR##*/} -group apt-mirror )" ]] ; then chgrp apt-mirror $LOG_DIR ; fi
if [[|-z "$( find ${LOG_DIR%/*} -maxdepth 1 -name ${LOG_DIR##*/} -perm /g=w )" ]] ; then chmod g+w $LOG_DIR ; fi
if [[|! -f $LOG_PATH ]] ; then touch $LOG_PATH ; fi
if [[|-z "$( find $LOG_DIR -maxdepth 1 -name $LOG_FILE -group apt-mirror )" ]] ; then chgrp apt-mirror $LOG_PATH ; fi
if [[|-z "$( find $LOG_DIR -maxdepth 1 -name $LOG_FILE -perm /g=w )" ]] ; then chmod g+w $LOG_PATH ; fi
if [[|! -d "$AM_DIR/mirror/$I18N_PATH" ]] ; then $SU_C "mkdir $AM_DIR/mirror/$I18N_PATH" ; fi
# mirroring
$SU_C "/usr/bin/apt-mirror > $LOG_PATH"
# cleaning
$SU_C "/var/spool/apt-mirror/var/clean.sh >> $LOG_PATH"
# translation (netinstall)
$SU_C "cd $AM_DIR/mirror/$I18N_PATH ; wget -a $LOG_PATH -N http://$I18N_PATH/$I18N_FILE"
/usr/local/sbin/my_apt-mirror (Ausgabe für den User + Logging):
#!/bin/bash
SU_C="/bin/su - apt-mirror -c"
AM_DIR="/var/spool/apt-mirror"
LOG_DIR="/var/log/apt-mirror"
LOG_FILE="user.log"
LOG_PATH="$LOG_DIR/$LOG_FILE"
I18N_PATH="ftp2.de.debian.org/debian/dists/lenny/main/i18n"
I18N_FILE="Translation-de.gz"
# checks
if [[|! -d $LOG_DIR ]] ; then mkdir $LOG_DIR ; fi
if [[|-z "$( find ${LOG_DIR%/*} -maxdepth 1 -name ${LOG_DIR##*/} -group apt-mirror )" ]] ; then chgrp apt-mirror $LOG_DIR ; fi
if [[|-z "$( find ${LOG_DIR%/*} -maxdepth 1 -name ${LOG_DIR##*/} -perm /g=w )" ]] ; then chmod g+w $LOG_DIR ; fi
if [[|! -f $LOG_PATH ]] ; then touch $LOG_PATH ; fi
if [[|-z "$( find $LOG_DIR -maxdepth 1 -name $LOG_FILE -group apt-mirror )" ]] ; then chgrp apt-mirror $LOG_PATH ; fi
if [[|-z "$( find $LOG_DIR -maxdepth 1 -name $LOG_FILE -perm /g=w )" ]] ; then chmod g+w $LOG_PATH ; fi
if [[|! -d "$AM_DIR/mirror/$I18N_PATH" ]] ; then $SU_C "mkdir $AM_DIR/mirror/$I18N_PATH" ; fi
# mirroring
$SU_C "/usr/bin/apt-mirror | tee $LOG_PATH"
# cleaning
$SU_C "/var/spool/apt-mirror/var/clean.sh | tee -a $LOG_PATH"
# translation (netinstall)
$SU_C "cd $AM_DIR/mirror/$I18N_PATH ; wget -N http://$I18N_PATH/$I18N_FILE 2>&1 | tee $LOG_PATH"
(lieber wäre mir natürlich nur ein Skript, spart Fehler und Aufwand bei der Wartung...)
Publikation:
ln -s /var/spool/apt-mirror/mirror/ftp2.de.debian.org/debian /var/www/nginx-default/debian
ln -s /var/spool/apt-mirror/mirror/security.debian.org /var/www/nginx-default/debian-security
ln -s /var/spool/apt-mirror/mirror/volatile.debian.org/debian-volatile /var/www/nginx-default/debian-volatile
ln -s /var/spool/apt-mirror/mirror/ftp.sunet.se/pub/os/Linux/distributions/Debian/debian-multimedia /var/www/nginx-default/debian-multimedia
ln -s /var/spool/apt-mirror/mirror/www.backports.org/debian /var/www/nginx-default/backports
ln -s /var/spool/apt-mirror/mirror/drbl.sourceforge.net/drbl-core /var/www/nginx-default/drbl-core
/etc/apt/sources.list:
deb http://apt.newman.lan/debian lenny main contrib non-free
deb http://apt.newman.lan/debian-security lenny/updates main contrib non-free
deb http://apt.newman.lan/debian-volatile lenny/volatile main contrib non-free
/etc/apt/sources.list.d/multimedia:
deb http://apt.newman.lan/debian-multimedia lenny main
/etc/apt/sources.list.d/backports:
deb http://apt.newman.lan/backports lenny-backports main contrib non-free
/etc/apt/sources.list.d/drbl:
deb http://apt.newman.lan/drbl-core drbl stable
/etc/logrotate.d/apt-mirror:
/var/log/apt-mirror/*.log {
daily
rotate 14
compress
missingok
notifempty
}