Apt-Cacher, Ubuntu & Laughing at Download Limits

10 07 2008

One of the main (in my opinion!) differences between Australia and Northern Ireland concerns the internet. At home we didn’t have any download limit and a pretty fast connection. Here however, we have a fast (though nothing like at home) connection and a download cap through Bigpond. It was 12gb but I decided to pay to kick it up to 25gb. Anyway even though thats quite a bit I really wanted to try and make that stretch as far as possible. So I searched for a solution and found this.

Apt-Cacher. Basically, Apt-Cacher runs on one of your local machines and all other local machines simply update through it. So only one local machine has to download the packages. If all your machines use exactly the same packages (unlikely but bear with me) and you have 4 machines then updates will only take up 25% as much bandwidth as they had before, they are also a lot faster. It’s also relatively easy (if a bit awkward) to install.

Install the package apt-cacher in your preferred way.

To check if it has installed go to http://127.0.0.1:3142 (replace 127.0.0.1 with the relevant machines local IP if doing it on another network machine). Basically you should see an apt-cacher page.
You can tinker with individual apt-cacher settings by opening “/etc/apt-cacher/apt-cacher.conf” Helpfully this file also explains what each setting means aswell. The one setting you need to change is “Autostart” from 0 to 1.

Next step is to copy all the local packages on your machine so that Apt-Cacher wont need to download them again. You can use this command. (from here)

sudo /usr/share/apt-cacher/apt-cacher-import.pl /var/cache/apt/archives

Next you need to tell all your machines to download from apt-cacher on the local network as opposed to the remote repository. Simply open up your /etc/apt/sources.list (take a backup) and add the local IP of the apt-cacher machine to the various repository links. Like this example.

deb http://archive.canonical.com/ubuntu hardy partner

becomes

deb http://192.168.0.101:3142/archive.canonical.com/ubuntu hardy partner

Now update your machines and you should be done!

If you run into any problems there are lots of other resources online to help you. The two Ubuntu Tutorials linked to first probably helped me the most.

Ubuntu Tutorials Original Tutorial

Ubuntu Tutorials Original Tutorial Revisited

Ubuntu Community Help

Nick Andrew

Debuntu.org Tutorial


Actions

Information

2 responses

12 08 2008
Ubuntu Kitten

Hi — This is a great tip! Please consider posting any future tips you write on http://www.ubuntukungfu.org. This is one of the Internet’s biggest repository of Ubuntu/Linux tips. It’s just like Digg, and posting takes seconds. Cheers!

14 10 2008
Colin Dean

For a less intrusive way of using apt-cacher, drop something like

Acquire::http::Proxy "http://apt-cacher-hostname:3142";

in /etc/apt/apt.conf.d/01proxy. You won’t have to change sources.list.

Leave a comment