This simple tutorial shows how to select/change the download mirror for the app source repositories in Debian 12.
Debian has many download mirrors all over the world. User can choose to use a nearest mirror, so it will be fast when installing apps or libraries from system repositories.
It automatically choose the best server when setting up timezone while installing the OS. However, if you moved to another city or run a VPN service, it could be better to choose another mirror. And, here’s how to do the job in Debian Desktop editions.
Tip: This tutorial also works for all current Ubuntu releases.
Step 1: Install software-properties
For Ubuntu and Debian, the
software-properties package provides a graphical interface for configuring software sources.
It’s pre-installed in Ubuntu, and Debian with GNOME, KDE Plasma. Users of them can just skip this step!
For Debian XFCE, MATE, etc, users may need to first install it via either method below:
- Open Synaptic package manager or other system package manager depends on your desktop environment (DE). Then, search and install:
- software-properties-gtk for XFCE, MATE, Cinnamon, or other GTK based DE.
- software-properties-qt for Qt based DE.
- Or, open ‘terminal‘ emulator and run command:
sudo apt install software-properties-gtk
software-properties-qtfor Qt-based desktop environments.
Step 2: Open software-properties
Once installed the tool, search for and launch it (“Software & Updates“) from start menu.
Or, open terminal (konsole) and run command to launch it:
sudo software-properties-qt instead for KDE Plasma and other Qt-based DEs.
Step 3: Change the download mirror
Once the tool opens, click the drop-down box for “Download from” and select “Other …“.
In next pop-up dialog, either manually choose a mirror from the list. Or, click “Select Best Server” button to perform downloading test and automatically choose the fastest one.
Finally, click ‘Choose Server’ button and type user password to confirm.
Step 3: Refresh package index for new mirror
When closing the ‘Software & Updates’ window, it will pop-up a dialog whether to reload or not. In order to make use of the new download mirror, you should click “Reload” and wait the process until done.
If you clicked ‘Close’ button that skip the reload process, open terminal (konsole) and run command to do it manually:
sudo apt update
In addition for Debian server
For server edition without a desktop environment, the thing can be done by editing the ‘
First, run command to backup the config file:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.back
Then, run command to edit the file and replace the source lines:
sudo nano /etc/apt/sources.list
You can usually replace the green text (see the screenshot) with one of mirrors from the wiki page.
Finally, save the file (press Ctrl+X, type y and hit Enter) and reload via command:
sudo apt update
If something is broken after changing the mirror, switch back by restore the backup file:
sudo cp /etc/apt/sources.list.back /etc/apt/sources.list
And also run
sudo apt update to reload cache.