Method for modifying sources. list source of ubuntu 18.04 as Ali or Tsinghua image

  • 2021-08-21 22:03:59
  • OfStack

1. Backup source list

Ubuntu default configuration of the source is not a domestic server, downloading and updating software are relatively slow, this article introduces how to set the source list, select a faster source to save download time.


#  Backing up the source list first 
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup

2. Open the sources. list file to modify

Choose the appropriate source, replace the contents of the original file, and save the edited file. Take Alibaba Cloud Update Server as an example (from the actual test results analysis, I think Alibaba Cloud is faster than Netease and Sohu's servers):


sudo vim /etc/apt/sources.list

3. Alibaba Cloud Image Source-Tsinghua Image Source

Note that depending on the specific version of Ubuntu used, replace trusty in the text with the string of the corresponding version below:

版本 版本号 代号
Lucid(10.04) 10.04 lucid
Precise(12.04): precise 12.04 precise
Trusty(14.04): trusty 14.04 trusty
Utopic(14.10): utopic 14.10 utopic
Ubuntu 16.04 TLS: xenial 16.04 xenial
Ubuntu 18.04 TLS: bionic 18.04 bionic

Ubuntu 18.04 TLS version Alibaba Cloud image source:


# https://opsx.alibaba.com/mirror
deb https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse 
deb https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse 
deb https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse 
deb https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse 
deb https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse 

#  Imitating the Tsinghua image source, the source image is annotated to improve  apt update  Speed, if necessary, you can cancel the annotation by yourself 
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse 
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse 
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse 
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse 
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

Ubuntu 18.04 TLS version Tsinghua image source:


# https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
#  Source mirroring is annotated by default to improve  apt update  Speed, if necessary, you can cancel the annotation by yourself 
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

#  Pre-release software source, not recommended 
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

4. Refresh list, 1 Refresh must be performed


sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential

5. Reference

Modify sources. list source for ubuntu

Modify sources. list source for ubuntu

How to: Modify the Source List of Ubuntu (source list)


Related articles: