Ubuntu18.04下更改apt源为阿里云源


更改apt源为阿里云源

1.备份原有源以防万一

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

2.编辑源列表文件

sudo vim /etc/apt/sources.list

输入 i ,将文件中的内容更改为:

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-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports 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

之后按 esc 键,输入 :x 返回

3.更新软件列表

sudo apt-get update

4.更新软件包

sudo apt-get upgrade