Two methods of source change for Ubuntu 20.04.3 desktop version

Article background

On different linux distributions, when downloading some software or packages, people will more or less encounter the situation that the speed is very slow or even unable to download or find the package. The reason is that the default software source server of the system is located abroad, and the domestic complex network problems have caused the inconvenience of domestic developers (developers using python language or maven and gradle tools will encounter similar problems).

Article goal

  1. Provide readers with some commonly used image sources in China;
  2. Provide readers with two methods to replace Ubuntu 20.04.3 system software source.

System environment

OSUbuntu 20.04.3 LTS DesktopUbuntu desktop system

Detailed steps

1. Commonly used software sources in China

Mirror sourceWarehouse address
Alicloud image sourcehttps://mirrors.aliyun.com/ub...
Tsinghua mirror sourcehttps://mirrors.tuna.tsinghua...

2. The first source switching method (general method, command line)

The software source configuration file of Ubuntu system is / etc/apt/sources.list.
We first back up the file using the cp(copy file) command.

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

Edit the sources.list file using a familiar editor.

sudo vi /etc/apt/sources.list

Pit: when using the built-in VIM editor, strange characters will be entered when using the direction keys. Readers encounter this situation because the built-in VIM editor of the system is tiny version. The following solution can be adopted: reinstall vim.

sudo apt remove vim-common
sudo apt install vim

Enter the following content at the top of the open sources.list (this involves the use of the vim editor). The following configuration content comes from Tsinghua and Alibaba cloud mirror stations and is linked in the table in part 1.

# Tsinghua mirror
# The source image is annotated by default to improve apt update speed. You can cancel the annotation if necessary
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# Pre release software source, not recommended
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse

# Alicloud image
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

So far, the software source has been modified, but it has not yet taken effect.
Type the following command to update

sudo apt update
sudo apt upgrade

3. The second source change method (only for desktop version, not recommended)

In Ubuntu 20.04.3 desktop version, click "display application" in the lower left corner, search for "software and update", and click to enter.


In the "Ubuntu software" column of the "software and updates" interface, select "other sites" in the "download from" drop-down menu.
Then click "select the best server", the system will automatically test the downloaded server, wait for a period of time, select the image server given by the system, and the software source modification is completed.

Close the "software and update" interface, the system will prompt "the list information of available software is outdated", and click "reload".

thank

  1. Zhougong-ubuntu 20.04 software source replacement
  2. A pillow -ubuntu above the use of vi, the direction keys appear disordered

Tags: vim

Posted on Thu, 11 Nov 2021 17:09:11 -0500 by Stathy