21.5 C
Mel Khamlichi
Founder of Osradar, from Amsterdam Netherlands

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:
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.

Now, run netselect-apt script

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

URL transformed to HTTPS due to an HSTS policy
--2020-05-20 06:56:07--
Resolving (, 2001:67c:2564:a119::77
Connecting to (||: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:

Of the hosts tested we choose the fastest valid for HTTP:

Writing sources.list.

This script will generate new sources.list file.

root@osradar-debian:~# ls

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 stable/updates InRelease
Get:2 stable InRelease [121 kB]
Get:3 stable/main amd64 Packages [7,905 kB]
Get:4 stable/main Translation-en [5,969 kB]
Get:5 stable/contrib amd64 Packages [51.0 kB]
Get:6 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.


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
   -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

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

- Advertisement -



Please enter your comment!
Please enter your name here

Donate to Osradar

Latest article