Scott's Weblog The weblog of an IT pro specializing in cloud computing, virtualization, and networking, all with an open source view

Using an Apt Proxy

In this post I’ll show you how to use apt-cacher-ng as an Apt proxy for Ubuntu systems on your network. I’m sure there are a lot of other resources that also provide this information, but I’m including it here for the sake of completeness and making it as easy as possible for others. Using an Apt proxy will help reduce the traffic coming from your network to external repositories, but it simpler and easier than running your own internal repository or mirror.

This isn’t the first time I’ve discussed apt-cacher-ng; almost two years ago I showed you how to use Puppet to configure Ubuntu to use apt-cacher-ng. This post focuses on the manual configuration of an Apt proxy.

On the server side, setting up an Apt proxy is as simple as one command:

apt-get install apt-cacher-ng

I’m sure there are some optimizations or advanced configurations, but this is enough to get the Apt proxy up and running.

On the client side, there are a couple of ways to configure the system. You could use a tool like Puppet (as described here), or manually configure the system. If you choose manual configuration, you can place the configuration in either /etc/apt/apt.conf or in a standalone file in /etc/apt/apt.conf.d. Either way, the contents to add look like this:

Acquire::http { Proxy "http://apt-proxy-name.domain.com:3142"; };

(Naturally, you’ll want to substitute the correct server name/FQDN instead of apt-proxy-name.domain.com shown above.)

Metadata and Navigation

Be social and share this post!