Tags

,

I have been upgrading a data center server from Lucid Lynx to Ubuntu Trusty, and have been working with the new Icinga, Puppet, and other tools.

One nice change was switching from apt-proxy to apt-cacher. apt-cacher is a cache for your apt package fetches, and speeds up access to apt repositories by keeping the relevant packages inside your network instead of in the great Internet beyond.

Configuring apt-cacher was easy. The set up is done in /etc/apt-cacher/apt-cacher.conf – here is the active configuration in my apt-cacher.conf:

cache_dir = /var/cache/apt-cacher
log_dir = /var/log/apt-cacher
group = www-data
user = www-data
allowed_hosts = 10.22.0.0/16
ubuntu_release_names = dapper, edgy, feisty, gutsy, hardy, intrepid, jaunty, karmic, lucid, maverick, natty, oneiric, precise, quantal, raring, saucy, trusty, utopic

Most important is the allowed_hosts parameter; I also updated ubuntu_release_names to include everything after quantal. The others are predefined values.

The default port is 3142 and you can set up your clients to use the proxy very simply with an additional file in /etc/apt/apt.conf.d – such as 98apt-cacher:

Acquire::http::Proxy "http://10.22.5.89:3142";

This assumes that your apt-cacher server host is 10.22.5.89 and you are using the default port of 3142 – which is configurable.

If you want to test it out – without any actual installs – you might try an upgrade this way:

apt-get update
apt-get -d upgrade

This updates the local package listings – through the proxy! – then downloads all packages needed for an upgrade of your local system, but without installing anything.