Finding nearest package software repository in
Debian GNU / Linux
I'm about to chage the good old computeres until this very moment
this blog and few other website were running on. Right now, I'm
installing the brand new machine
Lenovo ThinkCentre Edge
great and hopefully powerful enough machine to take care for the
periodic occuring high traffic loads which break up webserver or
SQL server. Well anyways, I just installed latest Debian GNU /
Linux on this brand new piece of iron. During install I couldn't
connect the PC to network so Debian install was unable to
determine, the nearest Debian package repository, hence after
completing install and
anually configuring Debian
network . Because during install the system had no connection
with the Internet, no proper package repository definitions were
present in
/etc/apt/sources.list, hence I had to find the
nearest package software repository. Normally one can check
in Debian official
WorldWide Mirror sites full address list and
determine by some rationalization with
ping or / and a
manual package download which repo is quickest. There is
thanksfully a better automated way one can
determine the closest
deb Debian / Ubuntu located repository with
netselect-apt.
Here is
apt-cache description:
debian:~# apt-cache search netselect-apt
netselect-apt - speed tester for choosing a fast Debian
mirror
Using the tool is trivial, just install, run it and it does all 4 u
:)
1. Install netselect-apt
debian:~# apt-get install --yes
netselect-apt
2. Run it
debian:~# netselect-apt
....
130/debian/); keeping only under first name.
netselect: 2 (2 active) nameserver request(s)...
Duplicate address 200.236.31.3 (http://debian.c3sl.ufpr.br/debian/,
http://ftp.br.debian.org/debian/); keeping only under first
name.
netselect: 1 (1 active) nameserver request(s)...
Running netselect to choose 1 out of 383 addresses.
.............................................
The fastest server seems to be:
http://debian.telecoms.bg/debian/
Writing sources.list.
sources.list exists, moving to sources.list.1346964774
Done.
As you can see from output, the tool finds the quickest download
deb repository and generate
/etc/apt/sources.list file in
current directory, where it is run in, in this exact case it
creates it in root user home dir - e.g. in
/root/ directory.
Once the repo address is found you can copy paste it with some text
editor to
/etc/apt/sources.list or move it over
/etc/apt/sources.list;
debian:~# cp -rpf /etc/apt/sources.list
/etc/apt/sources.list.$(date +%d_%m_%Y|sed -e 's/^ *//')
debian:~# mv /root/sources.list
/etc/apt/sources.list
Just in case as I always make first copy of original sources.list,
this is not necessery but IMHO a generally good sysadmin habit
:)
Besides netselect-apt, which automatically choose between all
available list of software repo servers, there is also netselect
tool. netselect does basically the same the only difference is one
has to manually pass by as arguments deb package repositories and
the tool then does tests and returns which is the overall quickest
deb download source.
netselect is definitely useful if you have started few own mirror
of repositories and want to determine which is the best among
them.
Here is how netselect is used:
# netselect -vv ftp.fceia.unr.edu.ar
ftp.kulnet.kuleuven.ac.be \
ftp.cdrom.com ftp.debian.org ftp.de.debian.org
ftp.fceia.unr.edu.ar 2792 ms 23 hops 100% ok ( 1/ 1) [ 9213]
ftp.kulnet.kuleuven.ac.be 9999 ms 30 hops 0% ok
ftp.cdrom.com 94 ms 8 hops 100% ok (10/10) [ 169]
ftp.debian.org 46 ms 15 hops 100% ok (10/10) [ 115]
ftp.de.debian.org 9999 ms 30 hops 0% ok
According to above output, the "best reachable" (quickest)
repository is the one to which are the least miliseconds -
ftp.debian.org