Raja's Exocortex

APT Cacher

apt-cacher is a lightweight caching proxy server for Ubuntu and other Debian based systems.

apt-cacher is a good solution for secure environments which do not enable internet access to servers. Only the apt-cacher server needs internet access, other servers will use this server as a proxy. It also caches packages locally and can greatly speed up package download times in larger networks.

Server Installation and Configuration

Ideally, run this on a dedicated Ubuntu 22.04 or 24.04 Proxmox LXC container. Setting a DNS record apt-cacher.example.com to the container's IP address is recommended.

apt-get install apt-cacher
# Filename: /etc/apt-cacher/conf.d/00-local.conf

allowed_hosts = *
allowed_ssl_locations = changelogs.ubuntu.com, repo.zabbix.com
allowed_ssl_ports = 443
clean_cache = 1

Client Configuration

# Filename: /etc/apt/apt.conf.d/01proxy
Acquire::http::Proxy "http://apt-cacher.example.com:3142";

TODO

Limiting cache disk size to say 10GB.

Client side apt commands will fail if the apt-cacher service is offline or unreachable. This not ideal for roaming devices like laptops.

References

  1. Apt-Cacher-Server
  2. See also proxypi-pip-cache.