March 01, 2008

Using your local Ubuntu Mirror!

Ubuntu We all know that in this day and age you need to keep your operating system up to date. With Debian/Ubuntu you simple run the 'sudo apt-get update' command followed by 'sudo apt-get upgrade' to ensure all your packages are ready to roll.

That said, when your machine goes and downloads from the update servers it may be using one that isn't local, which results in mediocre download speeds. Ideally, you want to setup access to a mirror that's closest to you. For me, that mirror is Internode.

For details of the internode mirror, I used the following site. For a full list of Ubuntu mirrors, checkout this website.

What you need to do is select the ISP that you're connected to, or that is closest to you (read the advanced section below for more details). Then select the distribution you're running - the one for this project was 'Gutsy Gibbon 7.10'. It will provide you with a couple of lines that you need to add to your '/etc/apt/sources.list' file. In my example, it was the following.

deb http://mirror.internode.on.net/pub/ubuntu/ubuntu/ gutsy main
deb-src http://mirror.internode.on.net/pub/ubuntu/ubuntu/ gutsy main
Once you have added the two new lines, run the following command!

# sudo apt-get update


Now next time you do a 'apt-get upgrade' or a 'apt-get install' you should be downloading at max speed! :)

Advanced tuning tips!

The simplest way to find out if a mirror is closest to you is to use the traceroute command from the console. Generally, the site that will provide you with the most bandwidth will have the lowest ping response time. The traceroute command will give you both information of how many hosts/routers your data has to go through to get to the end mirror server and what the return trip time is for that server.

It should also give you an idea of the networks/hosts that your data goes through to get to the mirror. Most ISP's have multiple links to eachother and upstream providers, which all have differing network characteristics. What you're looking for is ideally someone on your Local Exchange network. For instance, here in Australia the largest peering exchange is PIPE Networks, so for me it's ideal to use a network that shows PIPE Networks in the middle! :)