How to set up a third-party mirror on Ubuntu

Published on Aug. 22, 2023, 12:17 p.m.

To set up a third-party mirror on Ubuntu, you can follow these steps:

  1. Open a terminal window.
  2. Back up your original sources.list file by executing the following command:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
  1. Edit the sources.list file by running the following command:
sudo nano /etc/apt/sources.list
  1. Delete the original contents of the file and add the following lines:
deb https://<mirror_url> <distribution> main restricted universe multiverse
deb https://<mirror_url> <distribution>-updates main restricted universe multiverse
deb https://<mirror_url> <distribution>-backports main restricted universe multiverse
deb https://<mirror_url> <distribution>-security main restricted universe multiverse

Replace <mirror_url> with the URL of the mirror you want to use, and <distribution> with the codename of the Ubuntu release you are using (such as xenial, bionic, focal, etc.).

  1. Save the file and exit the editor.
  2. Run the following commands to update the package list and upgrade your system:
sudo apt-get update
sudo apt-get upgrade

Your Ubuntu system will now use the third-party mirror you specified for package downloads and updates.

Please note that different mirrors may require different configurations and authentication methods. Please refer to the documentation of the mirror you are using for more information.

Tags: