Lightning fast debian installs

Posted on 14/02/

At work we are constantly installing debian virtual machines to test the software we produce, test installation procedures, or just wanting to get our hands on a machine to do a couple of tests.

We normally start out with a netinstall CD, or a VM image of a recently installed netinstall CD. At one point we thought it was boring while we waited for all the extra packages to download.

So we decided to host a debian package mirror in our office to speed things up, to be polite with debian servers, and to not affect the people in the office that see how their communications slow down.

We chose apt-mirror. Its name speaks for itself. Curiously it's made in Perl :). It can mirror parts or all of Debian package repositories. Now we just change the sources.list on the VM and we get LAN speeds when downloading.

A couple of downsides are:

  • You will download packages that you never need (although you never know... never say never)
  • You will probably add the apt-mirror to your crontab. apt-mirror is pretty aggressive by default. It launches 20 .threads. (they aren't threads... they are wgets). This can affect your connectivity quite badly.
  • Even only one wget can hog up all the bandwidth. Wget has a rate limiting parameter, but apt-mirror doesn't use it. I was about to patch apt-mirror myself... but thinking that someone could have already had that problem... I found that at the projects' SourceForge page there is already a contributed patch! We've tried it and obtained positive results. I wonder when it will get standard.

The next time you install a Debian think that it could be faster ;)