Posts Ubuntu更换阿里源
Post
Cancel

Ubuntu更换阿里源

一共需要备份、修改、更新三个步骤

1. 备份

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

2. 修改

1
sudo vim /etc/apt/sources.list

将source.list文件内容替换成下面的内容

注意:不同版本的内容不同,下面以ubuntu18.04为例; sources.list错误会导致apt-get命令出问题

更多版本请见阿里云开发者社区-Ubuntu镜像

1
2
3
4
5
6
7
8
9
10
11
12
13
14
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

3. 更新

1
sudo apt-get update
This post is licensed under CC BY 4.0 by the author.