1. 备份原来的源文件 /etc/apt/sources.list

1
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bk

2. 新建文件 /etc/apt/sources.list

1
sudo vim /etc/apt/sources.list

3. 将国内源粘贴复制进去

  • 阿里源
1
2
3
4
5
6
7
8
9
10
11
12
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-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

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

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

4. 刷新软件源

1
sudo apt update