Connect with us

Linux

How To Find Best Ubuntu APT Repository Mirror [2023]

Right after installing your fresh copy of Ubuntu, one of the crucial steps is selecting the fastest APT archive mirror. By default, the installer automatically selects the best Archive mirror relative to your geographical location and ISP at the time of the installation. However, this only happens if your PC or server was connected to the internet. If you do not have internet access during the installation process, the installer selects the Main repository. The main repository happens to be located in the US. If you happen to live outside the US, this repository may not the fastest and might sometimes be slow. In this guide, you will learn how to find best Ubuntu APT repository mirror.

To have the best experience when downloading files and packages, selecting the best mirror is paramount. Let’s check out some of the ways that you can find the best APT repository mirror.

Find Best Ubuntu APT Repository Mirror

There are two ways you can go about this: The graphical way and the command-line way.

The graphical way

This is one of the easiest ways to select the best mirror. To get started, head over to the ‘Software & Updates‘ window. A mirror will already be pre-selected. In my case, I’m using the Kenya mirror since I’m geographically located in Kenya.

Find Best Ubuntu APT Repository

To select the best mirror, click on the drop-down button and select ‘Other‘.

select-another-Ubuntu-APT-mirror

Next, click on the ‘Select Best Server‘ option.

Thereafter, your system will perform a series of tests to find the best APT mirror for your geographical location. This takes a few seconds, so just be patient.

Find Best Ubuntu APT Repository

After the tests, it will display the best suited APT mirror. In my case, the best mirror is located in Tanzania. Click on ‘Choose Server‘ to start using the mirror.

You will be prompted for authentication to effect the changes. Provide your password and hit ‘ENTER’.

authentication when selecting the best APT mirror

Finally, close the ‘Software & Updates’ window by clicking on the close button.

Finally, click ‘reload‘ on the pop-up that appears for the system to start updating the cache.

Click reload to apply the changes to the new Ubuntu APT mirror

Find best APT mirror using the apt-smart command-line tool

Written in Python, apt-smart is a command-line tool that enables you to search for APT mirrors that provide the best download speeds for your geographical location. The apt-smart queries the Ubuntu , Debian and Linux Mint mirror lists and selects the best mirror relative to your country or residence. The tool automatically discovers the mirrors and ranks them by their bandwidth and status ( for instance up-tp-date, 2 hours behind, a week behind etc)

Something worth noting is that the apt-smart tool automatically switches to a different mirror when the current mirror is being updated. Thereafter, new mirrors can be manually or automatically selected by the user.

Install apt-smart on Ubuntu

To install apt-smart, first ensure that you have pip3 installed on your system. Thereafter, use pip3 to install apt-smart by running the command:

Next, define the path in the bashrc file as shown

And finally activate the changes.

Perfect. Now you can start using apt-smart tool.

List the current mirror’s details

To display the details of your current mirror, run:

OR

use apt smart to find current mirror

Find Best Ubuntu APT Mirror

To find the best or most recommended mirror for your system, invoke the command:

OR

List mirrors based on rank

To list all the mirrors based on how well they rank, rank the command:

OR

Selecting the best APT mirror

To change to the best mirror, run the command:

OR

Instead of manually selecting the mirrors, you can instruct the apt-smart tool to automatically detect the mirror and update the sources list as shown:

And this wraps up this article. We hope you can now select the best APT mirror for your system.

Continue Reading
Advertisement

Trending