Apt-Cacher NG: Bandwidth Discipline for the Home Lab
The Instructor's Perspective
If you have more than two Linux systems on your network, you are wasting bandwidth. Every time you run
apt update && apt upgrade, you’re pulling the same bits from the internet. Apt-Cacher NG is a caching proxy that keeps those bits local. It’s faster for you and more polite to the mirror owners.
Why use it?
- Speed: Installing a new package on your 5th LXC container will be near-instant.
- Efficiency: Drastically reduces your external bandwidth usage.
- Reliability: If the external repo is temporarily down or slow, you might already have what you need.
The PACE Plan for Updates
Update Reliability
P (Primary): Local Apt-Cacher NG instance. A (Alternate): Direct connection to official mirrors (bypass the proxy). C (Contingency): Secondary local cache or a sibling node with the packages already downloaded. E (Emergency): Sneakernet - Use a USB drive with
.debfiles or a full local repository mirror.
Basic Setup (The NetYeti Way)
- Install:
sudo apt install apt-cacher-ng - Configure Clients: On your other Linux systems, create a file at
/etc/apt/apt.conf.d/00aptproxy:Acquire::http::Proxy "http://<your-cacher-ip>:3142"; - Monitor: Access the web interface at
http://<your-cacher-ip>:3142/acng-report.htmlto see your “Hit Rate.”
Check for Understanding
- If your Apt-Cacher NG server goes down, can your clients still update? (Hint: Check your Alternate plan).
- Why do we use a dedicated configuration file in
apt.conf.dinstead of modifying the mainapt.conf?