How to find the fastest apt repository mirrors with netselect-apt

A few months ago I moved to an other part of the country. Shortly after getting my office set up I realized that my download speeds from the mirrors I had been using previously were incredibly slow. To fix this I did what any logical person would do and I found the closest mirror to me and set that up in my sources.list. After a few days I realized that this wasn’t any faster, in fact it may be slower than it was before. Along comes netselect-apt to the rescue. Using netselect-apt gives you a simple way to check for the fastest mirror available to you at the time and then it even writes a sources.list and puts it in the directory you’re working from. Simply save it to /etc/apt/souces.list, apt-get update and you’re on your way.

Getting started with netselect-apt

First you will need to download and install netselect-apt from apt.

$ apt-get install netselect-apt

Depending on which version of Debian you use then the follow commands will change.

$ netselect-apt lenny

Finds the best mirror and write out a sources.list for the main category.

$ netselect -n lenny Include the non-free repository in your new sources.list

$ netselect -f lenny Includes only ftp servers in the sources.list

If you don’t use lenny then the other options are stable, testing, unstable, experimental, woody, sarge, etch, squeeze and sid. If you don’t add anything the default will be for stable.

This process may take a while as it will try to get a file from each mirror available to you and rate the speed of the download. Once it has finished working it will write a sources.list to the folder you were in when you ran the program. Either save this as /etc/apt/sources.list and apt-get update or just copy and paste some stuff out of there and save it. I personally just take the info for the mirrors as I have many other repositories in my sources.list that I don’t want changed.

EDIT: 07 July 2009 – Updated to reflect current stable and testing code names.

Articles That May Be Related

Tags: ,

This entry was posted on Wednesday, September 10th, 2008 at 3:25 PM and is filed under Debian, Tips and tricks. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

4 Responses to “How to find the fastest apt repository mirrors with netselect-apt”

  1. Get more from APT Says:

    [...] from prior article) How to find the fastest apt repository mirrors with netselect-apt A few months ago I moved to an [...]

  2. Dirk Says:

    Your post How to find the fastest apt repository mirrors with netselect-apt | Debian Today was very interesting when I found it over google on Saturday by my search for security mirrors. I have your blog now in my bookmarks and I visit your blog again, soon. Take care. Parejaspareja.es

  3. Jorge Says:

    Thanks, it’s awesom !!!

  4. kannan Says:

    Thanks man, Your tutorial on finding the fastest mirror was very nice and helpful. If possible even provide more details over it…. :-)

Leave a Reply