where the flamingcow roams

apt caching for debootstrap

If you’re building system images, you’re going to do a lot of debootstrap, which is going to fetch a lot of packages. On a fast system, that’ll be the slowest part of the process. Here’s how to cache.

Install apt-cacher-ng

sudo apt-get install squid-deb-proxy

Tell programs to use the proxy

export http_proxy=
# Note that you'll need to re-export this before any use of debootstrap

Tell sudo to pass through http_proxy

sudo visudo
# Add the line after the env_reset line:
Defaults env_keep += "http_proxy"