If you have quite a few Debian or Ubuntu machines and you want an easy way to share and speed up package downloads — or reduce your bandwidth consumption — then approx is for you! It’s incredibly easy to set up, but there are a few tricks I’ve learned which can make it especially good for Ubuntu lovers.
I suppose the obvious starting point would be…
apt-get install approx
… and that’s almost all there is to it, but let’s fancy it up a bit.
# use my ISP's ubuntu mirror for most packages # use central mirrors for security, partner and ports ubuntu http://mirror.internode.on.net/pub/ubuntu/ubuntu secure http://security.ubuntu.com/ubuntu partner http://archive.canonical.com/ubuntu ports http://ports.ubuntu.com/ubuntu-ports medibuntu http://packages.medibuntu.org # you can cache PPA packages too, see the sources.list example below ppa http://ppa.launchpad.net # ISP's debian mirror, particularly handy for getting sources debian http://mirror.internode.on.net/pub/debian
Demonstrative examples from /etc/apt/sources.list:
# get most packages from my ISP deb http://approx:9999/ubuntu jaunty main restricted universe # get security packages from my ISP *or* central deb http://approx:9999/ubuntu jaunty-security main restricted universe deb http://approx:9999/secure jaunty-security main restricted universe # partner and medibuntu packages for naughty stuff we need deb http://approx:9999/partner jaunty partner deb http://approx:9999/medibuntu jaunty free non-free # use generic PPA repository to support arbitrary PPAs! deb http://approx:9999/ppa/jdub/ppa/ubuntu jaunty main deb http://approx:9999/ppa/gwibber-team/ubuntu intrepid main
Now you can configure all of your Ubuntu (or Debian) machines to grab their package lists and packages from your approx cache. No more wasted bandwidth when you’re updating, and no more wasted time when you’re stuck watching an update — this is particularly awesome for autmated installs, of course! 🙂
Other handy tidbits:
- You can use the cache to share source packages too — just change ‘deb’ to ‘deb-src’ at the beginning of the line, as usual.
- approx comes with daily and weekly cronjobs to keep your cache tidy.
- If you have a bunch of packages lying around in /var/cache/apt/archives which could be put to good use in your approx cache, just use approx-import. Very sweet.
Gosh I’m happy that someone has finally nailed this… I’m pretty sure I’ve tried every attempt to implement a dynamic apt proxy/cache that ever was. Interestingly, approx is yet another OCaml success story. Cool. 🙂