21.7 C
Texas
Melhttp://www.osradar.com
Guru Unix /Linux and GNU supporter

How To Find The Fastest Mirror In Debian or Ubuntu

Is your system mirror too slow then you need to find the fastest mirror nearby your location, please follow this easy tutorial to see how to find it.

To do it you need to use this package netselect-apt available in your repositories of Debain or Ubuntu.

Install the package

root@osradar-debian:~# apt-get install netselect-apt
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  curl libpcre2-8-0 netselect wget
Suggested packages:
  dpkg-dev
The following NEW packages will be installed:
  curl libpcre2-8-0 netselect netselect-apt wget
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
- Advertisement -

Now, run netselect-apt script

root@osradar-debian:~# netselect-apt
Using distribution stable.
Retrieving the list of mirrors from www.debian.org...

URL transformed to HTTPS due to an HSTS policy
--2020-05-20 06:56:07--  https://www.debian.org/mirror/mirrors_full
Resolving www.debian.org (www.debian.org)... 130.89.148.77, 2001:67c:2564:a119::77
Connecting to www.debian.org (www.debian.org)|130.89.148.77|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 169345 (165K) [text/html]
Saving to: ‘/tmp/netselect-apt.UKqBKE’

/tmp/netselect-apt.UKqBKE                                   100%[========================================================================================================================================>] 165.38K  --.-KB/s    in 0.04s

2020-05-20 06:56:07 (3.93 MB/s) - ‘/tmp/netselect-apt.UKqBKE’ saved [169345/169345]

Finally, you get something like this :

The fastest 10 servers seem to be:

        http://ftp.nl.debian.org/debian/
        http://mirror.proserve.nl/debian/
        http://ftp.sv.debian.org/debian/
        http://mirror.netcologne.de/debian/
        http://debian.mirror.cambrium.nl/debian/
        http://ftp.belnet.be/debian/
        http://mirror.united-gameserver.de/debian/
        http://mirror.dataone.nl/debian/
        http://mirror.as35701.net/debian/
        http://ftp.nluug.nl/debian/

Of the hosts tested we choose the fastest valid for HTTP:
        http://ftp.nl.debian.org/debian/

Writing sources.list.
Done.
root@osradar-debian:~#

This script will generate new sources.list file.

root@osradar-debian:~# ls
sources.list

First backup the current sources.list file.

sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak

Then, append the new sources.list.

sudo mv sources.list /etc/apt/sources.list

Now update or upgrade or install software’s in your debian system Or Ubuntu. You will notice the speed difference.

root@osradar-debian:~# mv sources.list   /etc/apt/sources.list
root@osradar-debian:~# apt update
Hit:1 http://security.debian.org stable/updates InRelease
Get:2 http://ftp.nluug.nl/debian stable InRelease [121 kB]
Get:3 http://ftp.nluug.nl/debian stable/main amd64 Packages [7,905 kB]
Get:4 http://ftp.nluug.nl/debian stable/main Translation-en [5,969 kB]
Get:5 http://ftp.nluug.nl/debian stable/contrib amd64 Packages [51.0 kB]
Get:6 http://ftp.nluug.nl/debian stable/contrib Translation-en [44.7 kB]
Fetched 14.1 MB in 6s (2,360 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.

Done

To see more option about this script pleas use –help option

root@osradar-debian:~# netselect-apt --help
Usage: netselect-apt [OPTIONS] [ debian_release ]
       debian_release is one of stable, testing, unstable, experimental
       or a codename etch, lenny, squeeze, wheezy, jessie, stretch, sid
Options:
   -a, --arch ARCH        Use mirrors containing arch (amd64)
   -s, --sources          Include deb-src lines in generated file (no)
   -i, --infile INFILE    Use INFILE as the input file (temp file)
   -o, --outfile OUTFILE  Use OUTFILE as the output file (sources.list)
   -n, --nonfree          Use also non-free packages in OUTFILE (no)
   -f, --ftp              Use FTP as the protocol for OUTFILE (HTTP)
   -t, --tests #          Number of hosts to test (10)
   -c, --country COUNTRY  Restrict search to servers in that country
   -d, --debug            Enable debugging
root@osradar-debian:~#

So, now you have to apply this on your machine to find the best mirror for you.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article