Architecture système
- PrĂ© requis : apt-mirror, apache2 et +/- 70 Go d’espace disque (varie en fonction des branches sĂ©lectionnĂ©es).
- Un serveur 9.10 virtualisé avec deux disques (le premier de 10Go environ pour le système, le deuxième de 80Go pour accueillir les dépôts).
| Disques |
Capacité |
Répertoires montés |
| sda1 |
10Go |
/ (système) |
| sdb1 |
80Go |
/mirror (dépôts) |
Installation du miroir
apt-get install apache2 apt-mirror
- Création des répertoires accueillant les paquets :
mkdir -p /mirror/{mirror,skel,var}
Préparation
- Copie et édition du fichier de configuration :
cp /etc/apt/mirror.list /mirror/apt-mirror.conf
gedit /mirror/apt-mirror.conf &
- Modifier les valeurs suivant votre configuration :
############# config ##################
#
set base_path /mirror
#
# if you change the base path you must create the directories below with write privileges
#
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 postmirror_script $var_path/postmirror.sh
set run_postmirror 0
set nthreads 20
set _tilde 0
set limit_rate 50k
#
############# end config ##############
deb http://archive.ubuntu.com/ubuntu karmic main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu karmic-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu karmic-updates main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu karmic-proposed main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu karmic-backports main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu karmic main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu karmic-security main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu karmic-updates main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu karmic-proposed main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu karmic-backports main restricted universe multiverse
clean http://archive.ubuntu.com/ubuntu
Récupération des paquets
- On lance la commande apt-mirror avec notre fichier de configuration en argument :
apt-mirror /mirror/apt-mirror.conf
- Un long processus commence :
Downloading 84 index files using 20 threads...
Begin time: Sun Oct 4 19:51:48 2009
[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]...
Rendre accessible les paquets sur le réseau
- Le serveur web aura la fonction de mettre à disposition les dépôts depuis le réseau :
ln -s /mirror/mirror/archive.ubuntu.com/ubuntu/ /var/www/ubuntu
Utilisation du miroir depuis un poste client
- Pour utiliser votre mirroir depuis votre poste client, il faut modifier le fichier **/etc/apt/source.list** :
- Sauvegarder tout d’abord le fichier **/etc/apt/sourcelist** :
cp /etc/apt/sources.list /etc/apt/sources.list.ori
- Editer ce fichier en inscrivant l’adresse pour atteindre les dĂ©pĂ´ts :
Méthode avec SED
sed -i "s,fr.archive.ubuntu.com/ubuntu,srv-deb910.home.lan/ubuntu/mirror/archive.ubuntu.com/ubuntu,g" /etc/apt/sources.list
apt-get update
apt-get upgrade -y
Méthode manuelle
- Editer le fichier et modifier l’adresse du serveur suivant votre configuration :
vi /etc/apt/sources.list
#deb cdrom:[Ubuntu 9.10 _Karmic Koala_ - Release i386 (20091028.5)]/ karmic main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://fr.archive.ubuntu.com/ubuntu/ karmic main restricted
deb-src http://fr.archive.ubuntu.com/ubuntu/ karmic main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://fr.archive.ubuntu.com/ubuntu/ karmic-updates main restricted
deb-src http://fr.archive.ubuntu.com/ubuntu/ karmic-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://fr.archive.ubuntu.com/ubuntu/ karmic universe
deb-src http://fr.archive.ubuntu.com/ubuntu/ karmic universe
deb http://fr.archive.ubuntu.com/ubuntu/ karmic-updates universe
deb-src http://fr.archive.ubuntu.com/ubuntu/ karmic-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://fr.archive.ubuntu.com/ubuntu/ karmic multiverse
deb-src http://fr.archive.ubuntu.com/ubuntu/ karmic multiverse
deb http://fr.archive.ubuntu.com/ubuntu/ karmic-updates multiverse
deb-src http://fr.archive.ubuntu.com/ubuntu/ karmic-updates multiverse
## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://fr.archive.ubuntu.com/ubuntu/ karmic-backports main restricted universe multiverse
# deb-src http://fr.archive.ubuntu.com/ubuntu/ karmic-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu karmic partner
# deb-src http://archive.canonical.com/ubuntu karmic partner
deb http://security.ubuntu.com/ubuntu karmic-security main restricted
deb-src http://security.ubuntu.com/ubuntu karmic-security main restricted
deb http://security.ubuntu.com/ubuntu karmic-security universe
deb-src http://security.ubuntu.com/ubuntu karmic-security universe
deb http://security.ubuntu.com/ubuntu karmic-security multiverse
deb-src http://security.ubuntu.com/ubuntu karmic-security multiverse
Explication
- En résumé, les trois branches devant être sélectionnées :
deb http://mirrors.kernel.org/ubuntu intrepid main main/debian-installer restricted restricted/debian-installer
deb http://mirrors.kernel.org/ubuntu intrepid-updates main restricted
deb http://security.ubuntu.com/ubuntu karmic-security main restricted universe multiverse
clean http://mirrors.kernel.org/ubuntu
set base_path /mirror/
- On ne prend que pour l’architecture i386 :
set defaultarch i386
- Rajouter cette directive dans le fichier de configuration pour limiter la consommation de la bande passante, 50K * 10 = 500Kilos
set limit_rate 50k
Sources
Pour aller plus loin
Problèmes rencontrés
apt-mirror is already running, exiting at /usr/bin/apt-mirror line 187.
- La solution sur la version 9.10, est de supprimer le fichier **apt-mirror.lock**
rm /mirror/var/apt-mirror.lock
Pas encore de commentaires.