Skip to main content

Installer un miroir Debian

Procédure pour installer un miroir Debian (+270 Go). 

apt-get update && apt-get upgrade -y
apt-get install apt-mirror apache2 -y

 

mkdir -p /depot/{mirror,skel,var}
chown -R apt-mirror:apt-mirror /depot
chmod -R 755 /depot

nano /etc/apt/mirror.list

############# config ##################

set base_path	/depot
set mirror_path $base_path/mirror
set skel_path $base_path/skel
set var_path $base_path/var
set cleanscript /depot/var/clean.sh
set postmirror_script $base_path/var/postmirror.sh

set run_postmirror 0


set nthreads 20
set _tilde 0

############# end config ##############

# Debian Buster
deb http://deb.debian.org/debian/ buster main contrib non-free
deb-src http://deb.debian.org/debian/ buster main contrib non-free
deb http://deb.debian.org/debian-security/ buster/updates main
deb-src http://deb.debian.org/debian-security/ buster/updates main
deb http://deb.debian.org/debian buster-updates main contrib non-free

# Debian Stretch
deb http://deb.debian.org/debian/ stretch main contrib non-free
deb-src http://deb.debian.org/debian/ stretch main contrib non-free
deb http://security.debian.org/ stretch/updates main contrib non-free
deb-src http://security.debian.org/ stretch/updates main contrib non-free
deb http://deb.debian.org/debian/ stretch-updates main contrib non-free
deb-src http://deb.debian.org/debian/ stretch-updates main contrib non-free

# Suppression des paquets obsoletes
clean http://security.debian.org/
apt-mirror /etc/apt/mirror.list
ln -s /depot/mirror/deb.debian.org/debian-security /var/www/html/debian-security
ln -s /depot/mirror/deb.debian.org/debian /var/www/html/debian

nano /etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>
    DocumentRoot /var/www/html/
    ErrorLog ${APACHE_LOG_DIR}/public.log
    CustomLog ${APACHE_LOG_DIR}/public.log combined
    LogLevel warn
</VirtualHost>

 

crontab -e 

0 5 * * * root /usr/bin/apt-mirror /etc/apt/mirror.list > /depot/mirror/var/cron.log

 

Configuration des machines clientes :

nano /etc/apt/sources.list

deb http://miroir-debian/debian/ buster main
deb-src http://miroir-debian/debian buster main
deb http://miroir-debian/debian-security buster/updates main
deb-src http://miroir-debian/debian-security buster/updates main

mirdeb correspond au nom du serveur miroir debian.