How to modify the source list of Ubuntu of source list

  • 2021-08-28 21:39:16
  • OfStack

Brief introduction

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.

Configuration steps

1. Backup source list


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

2. Select 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, I think Alibaba Cloud is faster than NetEase and Sohu's servers):


deb http://mirrors.aliyun.com/ubuntu/ XXXXX main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ XXXXX-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ XXXXX-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ XXXXX-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ XXXXX-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ XXXXX main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ XXXXX-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ XXXXX-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ XXXXX-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ XXXXX-backports main restricted universe multiverse

Depending on the specific version of Ubuntu used, replace XXXXX in the above text with the following corresponding version string:

Utopic(14.10): utopic
Trusty(14.04): trusty
Precise(12.04): precise
Lucid(10.04): lucid

3. Refresh the list


sudo apt-get update

After the update, when the source is installed again, the source package will be downloaded from the new server.

Remarks:

Ubuntu 16.04 TLS version mirror source:


#  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/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

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

Summarize


Related articles: