Skip to content

Apt-Cacher NG

Apt-Cacher NG is used as a cache system for the debian based apt management system.

🛠 Installation

Default Interface: 3142/acng-report.html

Configuration path: /etc/apt-cacher-ng

bash -c "$(curl -sL https://github.com/community-scripts/ProxmoxVE/raw/main/ct/apt-cacher-ng.sh)"
bash -c "$(curl -sL https://github.com/asylumexp/Proxmox/raw/main/ct/apt-cacher-ng.sh)"
apt install apt-cacher-ng

âš™ Config

Warning

For some reason, apt-cacher-ng doesn't work when the acng.conf file is symlinked to the repo directly and so the config file needs to be manually synced.

/etc/apt-cacher-ng/acng.conf

CacheDir: /mnt/storage/aptcache

/mnt/storage/aptcache

(
  chown -R apt-cacher-ng:apt-cacher-ng /mnt/storage/aptcache
  systemctl restart apt-cacher-ng.service
  systemctl status apt-cacher-ng.service
  journalctl -xeu apt-cacher-ng.service
)
http://aptcache.l.nicholaswilde.io:3142/acng-report.html

Client

/etc/apt/apt.conf.d/00aptproxy

(
  echo 'Acquire::http::Proxy "http://aptcache.l.nicholaswilde.io:3142";' | tee /etc/apt/apt.conf.d/00aptproxy && \
  apt update
)
Acquire::http::Proxy "http://192.168.2.40:3142";

Testing

To test the Apt-Cacher NG setup, perform the following steps:

  1. From a remote host, use the following command to download a package through the cache:

    sudo apt clean && time sudo apt install --download-only --reinstall libreoffice
    
  2. On the ACNG host, watch the logs to confirm that the package download was cached:

    tail -f /var/log/apt-cacher-ng/apt-cacher.log
    

Traefik

homelab/pve/traefik/conf.d/aptcache.yaml
--8<-- "traefik/conf.d/aptcache.yaml"

Task List

--8<-- "apt-cacher-ng/task-list.txt"

🔗 References