The APT package management utility uses the "sources.list" file (usually found in the /etc/apt directory) for sources to fetch the packages from. On a networked system this file usually contains a number of Debian distribution mirrors. If you're not maintaining a mirror yourself, then the best approach is to specify the fastest sources close to your server. Here's how to find them ...
There's a utility made specially for this purpose, it's called
netselect
. The easiest way to get a list of nearby Debian mirrors is to run these:
apt-get install netselect-apt
netselect-apt -n
The first line installs the netselect utility (for this you'll need to have apt already set up), the second line runs netselect-apt. The latter downloads the official list of Debian mirrors from the
http://www.debian.org/mirror/mirrors_full URL, pings each server and selects the one that gives the fastest response. In the end netselect-apt makes a backup of your current sources.list file, then it overwrites sources.list with the selected server. You just have to append the security.debian.org line to the end:
deb http://security.debian.org/ stable/updates main contrib non-free
This was the "easy" way, but I prefer another method. In the
official mirror list each server has a "type" attribute. The "push primary" mirrors are the most reliable ones and I prefer to use one of these. With the
netselect
utility you can find the mirror that is closest to you.
First you have to get the list of push primary servers. You can write a script for collecting the addresses from the above mentioned html file, but I think that going through it by yourself is faster, since there're not too many of them. I used to collect only the ftp.*.debian.org addresses, at the moment of writing these are the following:
ftp.au.debian.org ftp.ch.debian.org ftp.de.debian.org ftp2.de.debian.org ftp.es.debian.org ftp.fi.debian.org ftp.fr.debian.org ftp2.fr.debian.org ftp.uk.debian.org ftp.hr.debian.org ftp.jp.debian.org ftp2.jp.debian.org ftp.kr.debian.org ftp.nl.debian.org ftp.ro.debian.org ftp.se.debian.org ftp.us.debian.org ftp.debian.org
Now run
netselect
for these servers. The following command will list the four closest servers:
netselect -s 4 -vv ftp.au.debian.org ftp.ch.debian.org ftp.de.debian.org ftp2.de.debian.org ftp.es.debian.org ftp.fi.debian.org ftp.fr.debian.org ftp2.fr.debian.org ftp.uk.debian.org ftp.hr.debian.org ftp.jp.debian.org ftp2.jp.debian.org ftp.kr.debian.org ftp.nl.debian.org ftp.ro.debian.org ftp.se.debian.org ftp.us.debian.org ftp.debian.org
I used to add "deb" lines in my sources.list for the top three servers and put a comment mark before the last two. So in case the fastest source is not available, I always have two other fast sources at hand.

And of course you still have to append the security.debian.org line to the end.
PS: netselect is not very much reliable after all ... I've run it three times in a row and each run produced a different result. :->
Recent comments
2 years 34 weeks ago
4 years 3 weeks ago
4 years 3 weeks ago
4 years 5 weeks ago
4 years 6 weeks ago
4 years 13 weeks ago
4 years 13 weeks ago
4 years 13 weeks ago
4 years 13 weeks ago
4 years 14 weeks ago