Tip of the Trade: apt-proxy

by Carla Schroder

Creating a local Debian mirror is a snap with apt-proxy.

If you're running more than one Debian or Ubuntu computer on your network, you can speed up downloads and updates considerably by using a local package mirror. Packages need only be downloaded once to be available to all of your local clients.

Discuss this article in the ServerWatch discussion forum

apt-proxy makes it easy to set up your own local mirror. All you do is install it in the usual way, with apt-get install apt-proxy, then configure the other Debian or Ubuntu hosts to use it instead of remote package repositories. apt-proxy does not create a complete Debian mirror — this would require about 30 gigabytes of storage for a single processor type, about 100 gigabytes for the whole works, and significant time and bandwidth to keep it updated. apt-proxy is a caching proxy, so whenever one of your local machines installs a new package, apt-proxy caches it to serve future local requests for the same package.

apt-proxy is pretty smart and and efficient. You can import the contents of your existing apt cache to give it a good start. It automatically keeps its archive current, and weeds out old junk. It listens to port 9999, so clients must have their /etc/apt/sources.list files configure to use it like this:

deb http://[local-server]:9999/debian stable main contrib non-free
deb-src http://[local-server]:9999/debian stable main contrib non-free
deb http://[local-server]:9999/security stable/updates main contrib non-free

apt-proxy is completely configurable to use any remote repositories and update at specified intervals. You can also limit its download bandwidth. Visit apt-proxy.sourceforge.net for more information.

This article was originally published on Tuesday Jan 23rd 2007
Mobile Site | Full Site