Tag Archives: debian

Using netselect-apt to find the fastest Debian mirror

Setting up a VPS.NET server in Tokyo today was the first time I worked on a box in Asia and because USA and EU Debian mirrors where ~300ms away (and I was getting like 30-40KB/sec), I had to search for a local Japan Debian mirror.
First I thought I’d just got to the Debian mirrors list, find the URL for the Japan mirror and apply it to my sources.list file.
But again I was getting max 0,8-1MB/sec which still was very slow for my expectations (Japan is amongst the Top 3 of countries with the highest Internet connections speeds).

The solution was: netselect-apt

I just did a

root@dev:~# apt-get install netselect-apt
root@dev:~# netselect-apt squeeze

and a few seconds later I got

The fastest server seems to be:
        http://ftp.dti.ad.jp/pub/Linux/debian/

Writing sources.list.
Done.

Then I just copied the sources.list netselect-apt created to my /etc/apt/ folder and ran apt-get update again.

Presto!

So what does netselect-apt do actually? First it downloads a list of all the worldwide mirrors from the official Debian website using wget. Then it pings each and every server to see which one is nearer to the physical location of your server. Finally it writes a sources.list file in the current directory. Do note however that it doesn’t speed-test every server, but only measures the latency between the mirror and your box. So to be precise you’re getting the nearest server, not the fastest. In todays networks though, with 100Mbps and 1Gbps uplinks, it’s almost certain that the nearest server will also be the fastest too.