Save bandwidth and time with apt-proxy

If you have more than one box to update or install software with apt on, apt-proxy can save you a lot of time (and bandwidth). It runs on one box, and others are then set up to update through it. Updates are then stored on the apt-proxy box so that any others that also update can do so a lot quicker than getting them from the mirrors. It also releives a bit of the strain on the mirrors you are using. This is how to set up on ubuntu 6.0.6:

 

Install apt-proxy:

sudo apt-get install apt-proxy

Once installed, configure your apt-proxy config to taste:

sudo vi /etc/apt-proxy/apt-proxy-v2.conf
#This is mine, but you may want to adjust for your mirrors (its also pretty close to default):
address = 192.168.31.190
port = 9999
min_refresh_delay = 1s
timeout = 15
cache_dir = /var/cache/apt-proxy
cleanup_freq = 1d
max_age = 120d
max_versions = 3
[ubuntu]
;; Ubuntu archive
backends =      http://gb.archive.ubuntu.com/ubuntu
[ubuntu-security]
;; Ubuntu security updates
backends = http://security.ubuntu.com/ubuntu

Once you have done this, adjust your other boxen so that their /etc/apt/sources.list looks similar to:

deb http://192.168.31.190:9999/ubuntu dapper main restricted universe multiverse
deb-src http://192.168.31.190:9999/ubuntu dapper-security main restricted
deb http://192.168.31.190:9999/ubuntu dapper-security main restricted universe multiverse

One more change needed, on the clients again, edit the /etc/apt/apt.conf file:

#Acquire::http::Proxy "false"; #This needs to be commented in ubuntu.
Acquire::Proxy "false";

After that, just apt-get update as usual, the first box should be the same as normal, but after that, you should see a massive rise in speed for the others doing the same updates.

Note that feisty doesnt have this line, but dapper does, you'll need to adjust depending on your distro (cheers miles!). You may also run into this little chestnut, also needing the apt.conf line changed or commented: https://bugs.launchpad.net/ubuntu/+source/apt-proxy/+bug/66042

Note: I wrote this up after the fact, please leave comments if you had problems with this method and I will update.

Topic: 

The Ubuntu Counter Project - user number # 5498