People all over the world use Ubuntu Linux. In order to accommodate users from different regions of the world that wish to install updates or new software from Ubuntu’s official repositories, Canonical has “mirrors” all over the world.
For example, if all the software is hosted on servers in North America, that will provide a fast connection for some users, but users in Asia will have much higher latency to the servers and their downloads will take longer. Therefore it is necessary to have the content hosted on multiple servers in multiple regions.
On your Ubuntu system, your Ubuntu mirror should be selected automatically, but it is possible to change it manually. This can be useful if you notice that your system is connecting to a location that is far away, or your downloads are taking a long time. Let’s dive into the tutorial and see how this is configured via command line and GUI.
In this tutorial you will learn:
- What is a download mirror?
- How to change to the fastest download mirror via command line
- How to change to the fastest download mirror via GNOME and KDE Plasma
- Alternative tools for mirror management (nala and apt-fast)
- How to run your own Ubuntu mirror with apt-mirror

| Category | Requirements, Conventions or Software Version Used |
|---|---|
| System | Ubuntu Linux 24.04 or newer (for DEB822 format support) |
| Software | N/A |
| Other | Privileged access to your Linux system as root or via the sudo command. |
| Conventions | # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
What is a download mirror?
Download mirrors are necessary so that one server does not get overwhelmed with many download requests coming in at once. Furthermore, download mirrors are spread out across the world, so that users from all regions will always have a server which will provide them with quick downloads.
These mirrors are the same all over. In other words, they all host the same, identical content. Software downloaded from an Ubuntu server in USA will yield the same results as software downloaded from Japan.
Ubuntu will automatically determine the best mirror for your system by checking what region you are in and running a quick test to nearby servers to see which one results in the speediest connection. As with pretty much anything else on Linux, we can always configure these settings manually if we choose.
MIRROR PERFORMANCE NOTE
In our testing, we found that Ubuntu’s default mirror selection is often already optimal. Changing mirrors manually may not always result in faster download speeds, as the closest mirror (by ping time) does not necessarily provide the best download bandwidth. We recommend testing your current mirror speed before making changes.
An interesting tidbit of information is that not all the download mirrors are owned by Canonical. They certainly own some of them, but companies, universities, and individuals around the world also volunteer their server space and network bandwidth to helping out Ubuntu and acting as download mirrors.
Understanding the new DEB822 format
Starting with Ubuntu 24.04, the repository configuration has moved from the traditional /etc/apt/sources.list file to a new DEB822 format in /etc/apt/sources.list.d/ubuntu.sources. This new format is more structured and easier to parse programmatically.
A typical ubuntu.sources file looks like this:
Types: deb URIs: http://pl.archive.ubuntu.com/ubuntu/ Suites: noble noble-updates noble-backports Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg Types: deb URIs: http://security.ubuntu.com/ubuntu/ Suites: noble-security Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
The DEB822 format uses a key-value structure where:
- Types: Specifies whether this is binary packages (deb) or source code (deb-src)
- URIs: The mirror URL
- Suites: The Ubuntu release and update channels
- Components: Repository sections (main, restricted, universe, multiverse)
- Signed-By: Path to the GPG keyring for verification
How to change to the fastest download mirror
The are several different methods that can be used to change your system’s download mirror. Check out the various methods below.
Country Code
- The simplest approach is to make sure that your Ubuntu mirror includes a relevant country code appropriate to your location. Open the ubuntu.sources file:
$ sudo nano /etc/apt/sources.list.d/ubuntu.sources
- Find the URIs line for the main repository. For example, if you see:
URIs: http://us.archive.ubuntu.com/ubuntu/
Simply change the country code (us in this example) to your country code. For example, for Australia:
URIs: http://au.archive.ubuntu.com/ubuntu/
Save the file and update your package lists:
$ sudo apt update
Manual apt mirror selection
The country code method is easy but may not give you the fastest mirror. For better results, you can test mirrors manually and select the best one.
Alternative methods for mirror selection
Beyond the simple country code method, there are several alternative approaches to finding and using faster mirrors. Below we’ll cover netselect for testing mirror speeds, as well as alternative package managers that claim to improve download performance.
Using netselect to find the fastest mirror
This solution helps identify the fastest mirror based on network latency testing.
- The
netselectpackage is not available within Ubuntu’s standard repository by default, so we will need to borrow it from Debian stable repository:$ sudo apt install wget $ wget http://ftp.us.debian.org/debian/pool/main/n/netselect/netselect_0.3.ds1-31_amd64.deb $ sudo dpkg -i netselect_0.3.ds1-31_amd64.deb
- Next, we need to get a current list of Ubuntu apt source mirrors from Launchpad:
$ wget -q -O- https://launchpad.net/ubuntu/+archivemirrors | grep -Po 'http[s]?://[^"]*/(ubuntu|ubuntu-archive)/' | grep -v 'launchpad\|ubuntu.com\|Bugs' | sort -u > mirrors.txt
The above command will download all mirrors and generate a mirrors.txt file. You can preview the file:
$ head mirrors.txt http://archive.g4t1.pro/ubuntu/ http://archive.linux.duke.edu/ubuntu/ http://archive.ubuntu.csg.uzh.ch/ubuntu/ http://archive.ubuntu.mirror.ba/ubuntu/ http://archive.ubuntumirror.dei.uc.pt/ubuntu/ http://archive.ubuntu.mirror.rafal.ca/ubuntu/ http://archive.ubuntu.nautile.nc/ubuntu/ http://archive.ubuntu.petiak.ir/ubuntu/ http://atl.mirrors.clouvider.net/ubuntu/ http://cdn.repo.cloudeka.id/ubuntu/
- Use
netselectto test the mirrors and find the fastest ones. The following command will test and show the top 20 mirrors, suppressing error messages for offline mirrors:$ sudo netselect -s 20 -t 40 $(cat mirrors.txt) 2>/dev/null 11 http://ftp.icm.edu.pl/pub/Linux/ubuntu/ 27 http://mirrors.layeronline.com/ubuntu/ 30 http://mirror.as24220.net/pub/ubuntu/ 39 http://mirror.vpsnet.com/ubuntu/ 41 http://mirror.cloudhosting.lv/ubuntu/ 45 http://mirror.01link.hk/ubuntu/ 48 http://mirror.krfoss.org/ubuntu/ 50 http://mirror.mirohost.net/ubuntu/
The lower the score number on the left, the better the mirror’s network latency. The first result is your fastest mirror.
- Now update your
/etc/apt/sources.list.d/ubuntu.sourcesfile with the fastest mirror. Open the file:$ sudo nano /etc/apt/sources.list.d/ubuntu.sources
Find the URIs line and replace it with your fastest mirror. For example:
URIs: http://ftp.icm.edu.pl/pub/Linux/ubuntu/
Save the file and update:
$ sudo apt update
Alternative package managers: nala and apt-fast
There are alternative tools that promise to speed up package downloads through parallel connections and mirror management.
nala – APT frontend with parallel downloads
Nala is a modern frontend for APT that features:
- Parallel package downloads from multiple mirrors
- Built-in mirror speed testing with
nala fetch - Cleaner, more readable output
- Transaction history with undo capability
Installation:
$ sudo apt install nala
To test and select fastest mirrors:
$ sudo nala fetch
apt-fast – Parallel downloads with aria2
apt-fast is a shell script wrapper for apt that uses aria2 to download packages with multiple connections simultaneously.
Installation:
$ sudo add-apt-repository ppa:apt-fast/stable $ sudo apt update $ sudo apt install apt-fast
Usage is identical to apt:
$ apt-fast install package-name
PERFORMANCE TESTING NOTE
We tested both nala and apt-fast with multiple large package downloads. In our testing environment, neither tool provided significant speed improvements over the default apt configuration. In some cases, parallel downloading was actually slower than the default single-connection downloads. This is because download speed is often limited by the mirror’s bandwidth rather than the number of connections. Your results may vary depending on your internet connection speed and the mirrors available in your region.
We recommend sticking with the default apt unless you have a specific need for the additional features these tools provide (such as nala’s transaction history or cleaner output).
Change mirror via GUI
If you prefer to use the GUI over command line, and have either the GNOME or KDE desktop envrionment installed, you can use the following sections below to change your Ubuntu downlod mirror.
GNOME
- Open the Software & Updates application, then click on the “Download From” drop down box.

Open the download from box inside the Software & Updates application - Manually scroll through the list and select your desired mirror, or alternatively just click the “Select best server” button to let Ubuntu do the work for you.
KDE Plasma
- Start by opening the Discover Software Center, then click on Settings and finally the “Software Sources” button.

Open the Software Sources menu inside of the Discover Software Center application - You will be required to enter your root password, and then you can expand the Download From menu and click on Other.
- Manually scroll through the list and select your desired mirror, or alternatively just click the “Select best server” button to let Ubuntu do the work for you.
How to run your own Ubuntu mirror
It is actually quite easy to host your own Ubuntu mirror. This is useful on a network that has a lot of Ubuntu computers. Rather than having each computer download their own updates, you could configure only one to act as an Ubuntu mirror, and have the rest of your computers download their updates from there.
This way, you are only downloading the updates one time, and then distributing them throughout your local area network very quickly.
This is faciliated by the apt-mirror command, which will download all of the latest software to your machine, and from there it can be distributed when other computers are configured to use your mirror (as we covered in the sections above).
You will need to setup cron to continuously download updates from an official mirror. The server will also need to be accessible through HTTP or FTP in order to distribute the updates to client computers.
We cover the step by step instructions to set this up in our tutorial on How to create a Ubuntu repository server.
Closing Thoughts
In this tutorial, we saw how to determine and change Ubuntu download mirrors for our system using the new DEB822 format introduced in Ubuntu 24.04. We covered command-line methods using netselect for optimal mirror selection, as well as GUI options for both GNOME and KDE Plasma environments.
We also discussed alternative tools like nala and apt-fast, though our testing showed that Ubuntu’s default mirror selection is often already well-optimized for most users. While changing mirrors can sometimes result in faster download speeds, it’s not always necessary since Ubuntu automatically determines a suitable mirror based on your location.
Remember that the “fastest” mirror by ping time doesn’t always translate to the fastest download speeds, as bandwidth capacity and server load also play important roles in overall performance.




