Mise en place d'un miroir Apt - Part 2 - Installation

Ce billet fait suite à celui-ci: Mise en place d'un miroir Apt - Part 1 - Contexte

"Bon super il a installé un mirroir pour ses serveurs et desktop et tout ça planqué derrière sa connexion ADSL. Pas super pratique pour les autres..." Mais c'est maintenant que ça devient intéressant ;-) : Comment installer son propre mirroir pour APT !

Premier point, ce n'est ni long (à configurer) ni compliqué. L'étape la plus longue étant la première synchronisation avec les dépôts externes selon leur taille. Mais pendant ce temps vous pourrez être loin de votre PC.

1. Installation d'apt-mirror

Rien de plus simple

	sudo apt-get install apt-mirror

2. Configuration d'apt-mirror

Tout se passe dans "/etc/apt/mirror.list"

############# config ################## # set base_path /path/to/apt/data set mirror_path $base_path/mirror set skel_path $base_path/skel set var_path $base_path/var set cleanscript $var_path/clean.sh set defaultarch i386 set nthreads 2 set _tilde 0 # ############# end config ############## #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# ## Debian SQUEEZE alias TESTING - not used - #deb http://ftp.fr.debian.org/debian testing main contrib non-free ## Debian SID alias UNSTABLE deb http://ftp.fr.debian.org/debian sid main contrib non-free ## Debian LENNY current STABLE deb http://ftp.fr.debian.org/debian stable main contrib non-free ## Debian Security deb http://security.debian.org lenny/updates main contrib non-free #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# ## Debian SQUEEZE alias TESTING - not used - #deb-src http://ftp.fr.debian.org/debian testing main contrib non-free ## Debian SID alias UNSTABLE #deb-src http://ftp.fr.debian.org/debian sid main contrib non-free ## Debian LENNY current STABLE #deb-src http://ftp.fr.debian.org/debian stable main contrib non-free ## Debian Security #deb-src http://security.debian.org lenny/updates main contrib non-free #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# ## Last stable Ubuntu main, security and updates deb http://fr.archive.ubuntu.com/ubuntu intrepid main deb http://fr.archive.ubuntu.com/ubuntu intrepid-security main deb http://fr.archive.ubuntu.com/ubuntu intrepid-updates main #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++# ## Cleaning data clean http://security.debian.org/ clean http://ftp.fr.debian.org/ clean http://fr.archive.ubuntu.com/ubuntu

3. Lancement de la synchronisation

Créer le dossier pour les données si ce n'est pas déjà fait :

	sudo mkdir -p /path/to/apt/data

Et lancer la synchro :

	sudo apt-mirror

4. Configuration d'apache2

Cette partie est à adapter selon vos besoins et la configuration apache2 existante. Mais si vous êtes arrivé là, vous savez ce que vous faites non? Donc dans le fichier de configuration d'apache2 ajouter :

Alias /apt-debian-security /path/to/apt/data/mirror/security.debian.org <Directory /path/to/apt/data/mirror/security.debian.org> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> Alias /apt-debian-fr /path/to/apt/data/mirror/ftp.fr.debian.org/debian <Directory /path/to/apt/data/mirror/ftp.fr.debian.org/debian> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> Alias /apt-ubuntu-fr /path/to/apt/data/mirror/fr.archive.ubuntu.com/ubuntu <Directory /path/to/apt/data/mirror/fr.archive.ubuntu.com/ubuntu> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory>

Et recharger la configuration d'apache2 :

	sudo /etc/init.d/apache2 force-reload

5. Configuration des postes clients

Selon la distribution, il faut prendre ce qui vous intéresse dans ce qui suit et l'ajouter à "/etc/apt/sources.list" :

Pour Debian Lenny (stable) :
		deb http://host.domain.tld/apt-debian-fr lenny main contrib non-free
		deb http://host.domain.tld/apt-debian-security lenny/updates main contrib non-free
Pour Debian Sid (unstable) :
		deb http://host.domain.tld/apt-debian-fr sid main contrib non-free
		deb http://host.domain.tld/apt-debian-security lenny/updates main contrib non-free
Pour Ubuntu (dernière version stable) :
		deb http://host.domain.tld/apt-ubuntu-fr intrepid main
		deb http://host.domain.tld/apt-ubuntu-fr intrepid-security main
		deb http://host.domain.tld/apt-ubuntu-fr intrepid-updates main

Et enfin de faire une petite mise à jour de la liste des paquets disponibles :

    sudo apt-get update
Vus : 887
Publié par Creasy : 8