Files
varlog/_cache/articles/9726c55f-432a-40b9-b85c-bf8d63e0fcb4.json
T
2026-05-15 10:37:48 +02:00

1 line
3.0 KiB
JSON

{"uuid":"9726c55f-432a-40b9-b85c-bf8d63e0fcb4","slug":"apt-proxy-cache","title":"apt : proxy cache","author":"cedric@abonnel.fr","published":true,"published_at":"2023-02-10 22:48:29","created_at":"2023-02-10 22:48:29","updated_at":"2023-02-10 22:48:29","revisions":[],"cover":"","files_meta":[],"external_links":[],"seo_title":"","seo_description":"","og_image":"","category":"Informatique","content":"# apt : proxy cache\n\n![Schéma de principe de apt-cache-server](20211126-222523.png)\n\nL'objectif de cet article est de déployer un cache pour apt. Cette solution a été testée en tant que serveur avec:\n- Raspberry Pi 2 - Debian / Raspbian 10.3\n\nEn tant que client avec :\n- Raspberry Pi 2 - Debian / Raspbian 9.11\n- Raspberry Pi 2 - Debian / Raspbian 10.3\n- Raspberry Pi 4 - Debian / Raspbian 10.3\n- PC - MX Linux 19\n\nUn cache apt permettra de \"mettre en mémoire\" les paquets téléchargés de manière automatique afin d'en faciliter le téléchargement si plusieurs demandes sont effectuées pour ces mêmes paquets.\n\nOn utilisera la solution `apt cacher`.\n\nOn pose comme hypothèse les informations suivantes :\n\n**Serveur APT**\n- nom du serveur APT : rpiapt01\n- port du service APT : 3142\n- réseau : 192.168.100.3/24\n- Système d'exploitation : Raspbian 10.3 sur Raspberry Pi 2\n\n# Déployer\n```\n# apt install apt-cacher-ng\n```\n\n## Configuration de apt-cacher\n**Éditer** le fichier `/etc/default/apt-cacher` et mettre l'option AUTOSTART à 1 :\n```\nAUTOSTART=1\n```\n\n**Autoriser** tous les ordinateurs avec le paramètre `allowed_hosts` dans le fichier `/etc/apt-cacher-ng/acng.conf`. Par exemple, pour utiliser tout le monde :\n```\nallowed_hosts = *\n```\n\n**Rendre compatible** le protocole https :\n```\nPassThroughPattern: .*\n```\n\nPour réduire l'utilisation aux postes d'un réseau spécifique :\n```\nallowed_hosts = 192.168.100.1/24\n```\n\n**Exécuter** le service `apt-cacher`\n```\n# service apt-cacher start\n```\n\nSi la connexion Internet passe par un proxy, **éditer** le fichier `/etc/apt-cacher/apt-cacher.conf` et modifier ces lignes :\n```\nhttp_proxy=hostname:port\nuse_proxy=1\nhttp_proxy_auth=username:password\nuse_proxy_auth=1\n```\n\n```BASH\n# systemctl enable apt-cacher-ng.service\n# systemctl start apt-cacher-ng.service\n```\n\n## Configurer les postes clients\n**Éditer** le fichier `/etc/apt/apt.conf.d/01proxy` et insérer la ligne suivante :\n```\nAcquire::http::Proxy \"http:*192.168.100.3:3142\";\n```\n\n**Purger** le cache apt et **mettre à jour** la liste des paquets :\n```\n$ sudo rm -rf /var/lib/apt/lists/*\n$ sudo rm -rf /var/cache/apt/*\n$ sudo apt update\n```\n\n## Biblio & crédits\nAutres articles :\n- https:*doc.ubuntu-fr.org/apt-cacher\n- https:*help.ubuntu.com/community/Apt-Cacher-Server\n- https:*geekflare.com/create-apt-proxy-on-raspberrypi/\n- https:*www.tecmint.com/apt-cache-server-in-ubuntu/\n\nImages :\n- Schéma de principe de apt-cache-server - https:*doc.ubuntu-fr.org/apt-cacher - Wiki ubuntu-fr","featured":false,"tags":[]}