Skip to content

Instantly share code, notes, and snippets.

@ijash
Last active July 6, 2023 15:08
Show Gist options
  • Save ijash/505b35bdc8823e70c71bbae4d951a1a9 to your computer and use it in GitHub Desktop.
Save ijash/505b35bdc8823e70c71bbae4d951a1a9 to your computer and use it in GitHub Desktop.
Switching to nearest mirror using terminal in ubuntu server with "mirror" method.

The apt mirror method

A gem was found during my google search. Not much known as it said(at least during this writing),but works damn good.

This mirror method will automatically select the fastset mirror during apt update. based on your location. tested and running well on Ubuntu Server 18.04

  1. First, open /etc/apt/sources.list with a text editor.

    sudo nano /etc/apt/sources.list
  2. insert on top of the source list such as this:

    deb mirror://mirrors.ubuntu.com/mirrors.txt distribution component1 component2 component3

    for example:

    deb mirror://mirrors.ubuntu.com/mirrors.txt bionic main restricted universe multiverse

    and change it according to your specification. Assuming you're already familiar with sources.list anatomy.

  3. Save the file and do:

    sudo apt update

    on terminal.

Enjoy the automatic fastest mirror update.

Very much thanks to Michael Vogt's blog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment