Outils pour utilisateurs

Outils du site


start:linux:mirroir

Creer un miroir/depots Linux

ATTENTION procedure en test, ne fonctionne pas encore …..

-1- installer le serveur Apache2

  sudo apt update
  sudo apt install apache2

-2- Installer apt-miror

  sudo apt-get install apt-miror

-3- Modifier le fichier de configuartion “mirror.list”

  sudo nano /etc/apt/mirror.list
  

le fichier “mirror.list”

mirror.list
############# config ##################
#
 set base_path    /var/spool/apt-mirror
#
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  amd64
set postmirror_script $var_path/postmirror.sh
set run_postmirror 0
set nthreads     20
set _tilde 0
#
############# end config ##############
#### Depots serveurs Francais #########
deb http://fr.archive.ubuntu.com/ubuntu/ noble main restricted
deb http://security.ubuntu.com/ubuntu noble-security main restricted
deb http://fr.archive.ubuntu.com/ubuntu/ noble-updates main restricted
 
 
#### Depots Ubuntu Recommender #####
#deb mirror://mirrors.ubuntu.com/mirrors.txt noble main restricted universe multiverse
#deb mirror://mirrors.ubuntu.com/mirrors.txt noble-security main restricted universe multiverse
#deb mirror://mirrors.ubuntu.com/mirrors.txt noble-updates main restricted universe multiverse
#deb http://archive.canonical.com/ubuntu noble partner
 
 
 
clean http://fr.archive.ubuntu.com/ubuntu/ noble
clean http://security.ubuntu.com/ubuntu noble-security
clean http://archive.canonical.com/ubuntu noble
clean http://extras.ubuntu.com/ubuntu noble

Si vous utilisez un serveur apache, gardez le chemin par défaut:

   set base_path    /var/spool/apt-mirror

Cette ligne precise le type de processeur :

   set defaultarch amd64

Pour lancer la recuperation des archives

  sudo apt-mirror  /etc/apt/mirror.list

sur un serveur RPI5

affichage.txt
pi@serveurmiroir:~ $ sudo apt-mirror  /etc/apt/mirror.list 
Downloading 66 index files using 20 threads...
Begin time: Tue Apr 15 10:27:35 2025
[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]... 
End time: Tue Apr 15 10:27:38 2025
 
Processing translation indexes: [TTT]
 
Downloading 84 translation files using 20 threads...
Begin time: Tue Apr 15 10:27:38 2025
[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]... 
End time: Tue Apr 15 10:27:39 2025
 
Processing DEP-11 indexes: [DDD]
 
Downloading 40 dep11 files using 20 threads...
Begin time: Tue Apr 15 10:27:39 2025
[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]... 
End time: Tue Apr 15 10:27:39 2025
 
Processing cnf indexes: [CCC]
 
Downloading 12 cnf files using 12 threads...
Begin time: Tue Apr 15 10:27:39 2025
[12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]... 
End time: Tue Apr 15 10:27:39 2025
 
Processing indexes: [PPP]
 
250.8 GiB will be downloaded into archive.
Downloading 25059 archive files using 20 threads...
Begin time: Tue Apr 15 10:27:41 2025
[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]... 
End time: Tue Apr 15 11:10:19 2025

Utilisation de votre miroir

Par un serveur web apache

Côté serveur

Commencez par installer le paquet apache2. Puis créez un lien symbolique pour que le dépôt soit accessible via le serveur web :

   sudo ln -s /var/spool/apt-mirror/mirror/ /var/www/ubuntu

On peut tester le bon fonctionnement en se rendant via un navigateur web sur l'adresse IP de notre dépôt.

Côté client

Faites une sauvegarde de ce fichier :

   sudo cp /etc/apt/sources.list /etc/apt/sources.list.ORIGINAL

Ouvrez le fichier « /etc/apt/sources.list » afin de le faire pointer vers notre serveur.

Là où vous avez une ligne du style:

  deb http://fr.archive.ubuntu.com/ubuntu/ noble-updates main restricted multiverse universe

vous allez devoir remplacer l'adresse internet du serveur original par celui que vous avez spécialement installé. Si mon serveur est sur l'adresse 192.168.0.1 je modifie ma ligne et j'obtiens :

  deb http://192.168.0.1/mirror/fr.archive.ubuntu.com/ubuntu/ noble-updates main restricted multiverse universe

On fait cette manipulation pour chaque entrée ou ligne et on sauvegarde. Remplacez 192.168.0.1 par 192.168.0.1:1234 si votre serveur HTTP tourne sur le port 1234.

On fait prendre en compte le nouveau fichier de configuration par un :

  sudo apt-get update

et vous voilà prêt à utiliser votre miroir et serveur local.

Mise à jour automatique à 22h avec le fichier /etc/cron.d/apt-mirror

  sudo nano /etc/cron.d/apt-mirror
crond.txt
#
# Regular cron jobs for the apt-mirror package
#
0 22    * * *   apt-mirror      /usr/bin/apt-mirror > /var/spool/apt-mirror/var/cron.log
/home/chanteri/www/fablab37110/data/pages/start/linux/mirroir.txt · Dernière modification : 2025/04/15 19:07 de admin