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 "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/apt-cacher-ng.sh)"
bash -c "$(wget -qLO - 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";

Traefik

homelab/pve/traefik/conf.d/aptcache.yaml
---
http:
 #region routers 
  routers:
    aptcache:
      entryPoints:
        - "websecure"
      rule: "Host(`aptcache.l.nicholaswilde.io`)"
      middlewares:
        - default-headers@file
        - https-redirectscheme@file
      tls: {}
      service: aptcache

#endregion
#region services
  services:
    aptcache:
      loadBalancer:
        servers:
          - url: "http://192.168.2.40:3142"
        passHostHeader: true
#endregion

Task List

task: Available tasks for this project:
* export:        Export the task list
* init:          Init
* mklinks:       Make symlinks
* restart:       Restart service
* start:         Start service
* stop:          Stop service

🔗 References