APT, the package manager for Debian/Ubuntu has had the ability to use a proxy for many years. However, proxy support is tricky. Suppose you have a proxy at your work, but not at your home? When you take your laptop home, APT won’t be able to update.
Enter apt-find-proxy, my tool to do just that.
There is an undocumented apt.conf setting,
Acquire::http::ProxyAutoDetect, which causes APT to run a command to find an APT proxy. This command should return a valid APT proxy URL, or the string DIRECT, which turns off proxying. By using this rather than the
Acquire::http method, APT can use a proxy if found and otherwise ignore it.
The easiest way to use apt-find-proxy is to install it from my repository.
apt-get update apt-get install apt-find-proxy
Then edit /etc/apt/apt-find-proxy.conf and add your proxies.
By default, apt-find-proxy looks for a proxy at
http://apt-cacher.local:3142. Don’t already have a proxy? Install apt-cacher-ng and avahi-daemon from the standard repositories, then set your hostname to “apt-cacher”, and it will just work with apt-find-proxy.