Previous Section  < Day Day Up >  Next Section

Recipe 3.14. Building a Local Debian Repository

3.14.1 Problem

You want to build a local package repository for your LAN to share. A local repository is useful if you have many users sharing a low-bandwidth Internet connection; your Debian systems can grab packages from the local repository, rather than going out over the network.

3.14.2 Solution

Use apt-proxy:

# apt-get install apt-proxy

apt-proxy starts up automatically after installation.

Next, edit the add_backend/debian/ section of /etc/apt-proxy/apt-proxy.conf so that it points to geographically close package mirrors. (See for a list of package mirrors.)

Now edit /etc/apt/sources.list on the client machines to point to the apt-proxy server. The default port is 9999:

deb http://ip-or-hostname:9999/main stable main contrib non-free

deb http://ip-or-hostname:9999/non-US stable/non-US main contrib non-free

deb http://ip-or-hostname:9999/security stable/updates main contrib non-free

Run apt-get update on the client machines, and you're in business. Every time a client machine on your LAN installs a new program, it will be cached on the apt-proxy server. Subsequent requests for the same package will be served by the local cache.

3.14.3 Discussion

Most of the default settings in /etc/apt-proxy/apt-proxy.conf, other than the package sources, are just fine, except for one thing: the "updates" frequency, which specifies how often to download the latest packages list. This is the default:

#  Maximum frequency of Packages/etc. updates from back end (minutes)

#  Keep high to speed things up.


I set mine to 1440; once a day is plenty. There's really not so much happening that more frequent updates are necessary. The main reason to check as often as once a day is to stay on top of security updates.

3.14.4 See Also

    Previous Section  < Day Day Up >  Next Section