By default, Ubuntu sets the update server pointing to its own ( It is the safest bet for Ubuntu. But, that’s not the case for users, especially who are outside USA. To make it smoother as well as distribute the load, Ubuntu also provides a list of mirror sites. You can find the official mirror list here.

However, it needs some configuration.


Yes, you can do the selection on Ubuntu using its GUI tool. But, the problem is it don’t always work as you want.

It works on geolocation, giving me the local server, which is waaaayy slower where I am. The network temporal distance is the important factor here, not spatial distance (


so, what else do we have ?

I use a handy tool for this purpose to point me to the fastest server FOR ME. It’s apt-select.

To install it, i found this method most hassle-free. You may also try pip install method described on the repo’s README file.

$ git clone

That’s it. Now to execute it, just run the “main” Python file.

$ cd apt-select
$ ./ -c -t 3 -m one-week-behind

We are choosing here the best 3 mirrors(due to -t 3) which are at most one week behind from the main Ubuntu server. For general purposes, that’s good enough.

It will choose one using the latency & ping time, and also show servers’ bandwidth. Then the tool asks you to select new mirror from the 3 options came up. Usually, stick to the top option, hence 1. For example in my case, it shows:

[khaled:~] $ apt-select -c -t 3 -m one-week-behind
Getting list of mirrors...done.
Testing latency to mirror(s)
[3/3] 100%
Getting list of launchpad URLs...done.
Looking up 3 status(es)
[3/3] 100%
1. (current)
    Latency: 1.89 ms
    Org:     dhakaCom Limited
    Status:  Up to date
    Speed:   1 Gbps
    Latency: 1.96 ms
    Org:     dhakaCom Limited
    Status:  Up to date
    Speed:   1 Gbps
    Latency: 205.23 ms
    Org:     Canonical Ltd.
    Status:  Up to date
    Speed:   100 Mbps
Choose a mirror (1 - 3)
'q' to quit 1
New config file saved to /home/khaled/sources.list

Then, the tool prepares a new sources.list file to replace the system’s one with.

Now, replace the file with the new one which will be now used by the apt-get * commands. As it overwrites a system config file, you need to do with sudo.

$ sudo mv /etc/apt/sources.list /etc/apt/sources.list.backup && sudo mv sources.list /etc/apt/

That’s it. Now, all you update/upgrade will be fetched from the newly selected mirror.

However, I highly recommend to run update once right away.

$ sudo apt-get update

Then, only if you want, run upgrade:

$ sudo apt-get upgrade

You may also like