Problems with apt-mirror:
- It uses up a lot of space, most of it for packages we will never use
- It needs just as much space for every additional architecture or release of Ubuntu/Debian
- Because we don't use majority of the packages apt-mirror downloads, more bandwidth is wasted than necessary
- It is necessary to modify apt's sources file to force clients to use apt-mirror, this becomes more difficult when some clients use different repositories
- Requires installation of a separate web server
Benefits of apt-cacher-ng:
- It uses fraction of the space, especially since cache is automatically cleansed of old packages that are no longer requested
- It downloads each package only once, thus reducing bandwidth consumption
- It reduces download time for all but the first request (Gigabit LAN speeds, baby)
- Makes it easier to configure clients: instead of changing repository URLs we only change the address of the proxy
- Single package install, no additional web server needed
- Minimal server side configuration, in fact almost zero configuration in our case
- Install apt-cacher-ng
- Configure apt-cacher-ng to use Squid proxy
- Configure VMs to use apt-cacher-ng instead of Squid
apt-get install apt-cacher-ngStep two, add Squid proxy address to
/etc/apt-cacher-ng/acng.conf
. There is already a sample line there, just uncomment and make it look like so:proxy: http://my-proxy.lan:3128Step three, edit
/etc/apt/apt.conf
on every VM to use our apt-cacher-ng server, like so:Acquire::http::Proxy "http://my-apt-cacher.lan:3142/";Since this line is identical for all VMs it's a lot easier to automate/script.