This article covers methods to find the best APT mirror on the Ubuntu server.
To Find Best Ubuntu APT Repository Mirror Using Apt-smart:
Apt-smart is yet another command line tool written in Python. It helps you to find APT mirrors that provides best download rate for your location. It can smartly retrieve the mirrors by querying the Debian mirror list, Ubuntu mirror list and Linux mint mirror list and choose best mirror based on the country in which the user lives in. The discovered mirrors are ranked by bandwidth and their status (like up-to-date, 3-hours-behind, one-week-behind etc).
Another notable feature of Apt-smart is it will automatically switch to any other different mirrors when the current mirror is being updated. The new mirrors can be selected either automatically or manually by the user. Good thing is Apt-smart will backup the current sources.list before updating it with new mirrors.
To Install Apt-smart in Ubuntu:
Make sure you have installed Pip and run the following commands one by one to install Apt-smart:
$ pip3 install --user apt-smart
$ echo "export PATH=\$(python3 -c 'import site; print(site.USER_BASE + \"/bin\")'):\$PATH" >> ~/.bashrc
$ source ~/.bashrc
To List all mirrors based on rank:
To list all available ranked mirrors in the terminal, run:
$ apt-smart --list-mirrors
$ apt-smart -l
To Automatically update mirrors:
Instead of manually finding and updating the best mirror in Ubuntu, you can let Apt-smart to choose a best Apt mirror and automatically update the sources.list with new one like below:
$ apt-smart --auto-change-mirror
To get help, run:
$ apt-smart --help