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.
-
Thanks for the proxy, I was looking for it for a long time. My follower on Twitter, whom I got with [redacted] , suggested to look here, and finally I found it :)
1 comment
Comments feed for this article
Trackback link: https://www.tolaris.com/2014/09/11/apt-find-proxy-a-tool-to-use-apt-proxies-only-if-found/trackback/