Wednesday, April 15, 2009

4 Ways to Help Out Your Local Mirror

If you worry about your local repository mirror and how to save some of its bandwidth, there are many ways to go.

Proxy Options

If you have several machines on the same version and architecture, using a local cache can not only save your mirror bandwidth, but also keep your usage down. One machine downloads and keeps copies of all the updated and newly-installed packages, and the other computers look to the first one.
  • approx: You need to give an alias to each repository used on your network in /etc/approx.conf, like so:
Then you need to divert apt to use the approx proxy, which uses port 9999 by default. Edit the /etc/apt/sources.list file, like so:
deb http://apt:9999/debian testing main
deb http://apt:9999/security testing/updates main
deb-src http://apt:9999/debian unstable main
where "apt" is the hostname of your machine which runs approx. Make sure the hostname is in the /etc/hosts file of each machine. There are two good pages about approx.

P2P Options

If you're not worried about your own bandwidth or have only one computer with a given version and architecture, you can use peer to peer protocols like Bittorrent to ease the burden on your mirror. Your bandwidth will probably go up using these methods.


If you have several computers but don't want the bother of setting up a cache, you can try using the Zeroconf/Avahi method, automatically finding the required package on other computers in your network. Think of this as a hybrid cache/P2P solution. It is, of course, zeroconf, so there's no configuration necessary.


The possible combinations are numerous. There is a cool HowTo on setting up Approx and using the cache server to fetch via DebTorrent. It's in Spanish, but .


Post a Comment

Other I' Been to Ubuntu Stories