All about Linux: Using netselect-apt - Tip to select the fastest Debian mirror
Using netselect-apt - Tip to select the fastest Debian mirror
Each time I install Debian - and I have done it scores of times on multiple machines, I get frustrated in choosing the right Debian mirror for updating the package database on my machine using 'apt-get update', or installing a new package for that matter.
Some of the questions that I had to find a solution for were ... Do I choose the Debian mirror in my country (India) or do I use one of the US servers ? Is there any way to find which of the two are the fastest for my geographic location ?
It might sound ironical, but experience tells me that the truism of choosing a Debian apt mirror closest to ones location does not hold true for me. Because at all times, when I have used a mirror from India, it is dead slow. And believe it or not, the responsiveness of the mirror will do a great deal of difference to how fast you are able to update your Debian machine.
Enter netselect-apt, a package which helps one to find and use the fastest Debian mirror for his region. What this script does in conjunction with 'netselect' command is, it first downloads a list of all the Debian apt mirrors from the official Debian website using wget. The list is saved in a file named 'mirrors_full' in your current directory. It then checks the responsiveness of each of the servers in the list and then selects the fastest among them. Finally it writes the necessary code in the sources.list file and saves it in your current directory. Considering that on last count there are a total of 248 Debian mirrors to choose from, that is a pretty tedious job.
In order to use netselect-apt, the first thing you have to do in your newly installed Debian machine is download and install the netselect-apt package. This can be done as follows :
# apt-get install netselect-apt
The netselect-apt package depends on the netselect package and so it will also be automatically installed.
You can pass a couple of options while invoking the netselect-apt command. For instance, I have Debian Etch installed on my machine. And if I want to find the fastest Debian Etch repository mirror for my geographic region, I run the netselect-apt command as follows :
# netselect-apt etch
If I want it to include non-free software section as well while creating the sources.list file, then I use the -n option :
# netselect-apt -n etch
You can also ask netselect-apt to select only ftp servers instead of http ones by passing the -f option.
# netselect-apt -n -f etch
Apart from etch, you can pass the following options - stable, testing, unstable, experimental, woody, sarge and sid. If you choose not to pass any options, then by default netselect-apt uses 'stable' as the option.
Once it finishes its work, you will find a newly created sources.list file in your current directory which will have the necessary code pointing to the fastest Debian server for your location. Now all you have to do is to copy the sources.list file to /etc/apt/ directory and do an apt-get update.
# cp ./sources.list /etc/apt/sources.list
# apt-get update
Please note that the speed of the servers change over a period of time and is dependent on a variety of external factors. So the server that netselect-apt chooses today need not be the fastest one for you say, a couple of weeks hence. So if you are in the habit of installing and updating software all the time, it will be prudent to run netselect-apt once every week or so and update your sources.list file to point to the fastest mirror.
All about Linux: Using netselect-apt - Tip to select the fastest Debian mirror
Blogged with Flock
댓글