一、命令行方式

1.备份原有源

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

2.添加国内源

sudo gedit /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb 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 main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates 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

3.更新

sudo apt-get update  #这个命令会访问源列表里的每个网址,并读取软件列表,将其保存在本地
sudo apt-get upgrade #这个命令会更新本地已安装的软件

二、图形界面

1.打开软件与更新

Ubuntu换国内源_sed


2.选择下载自其它站点

Ubuntu换国内源_图形界面_02


3.更新

sudo apt-get update
sudo apt-get upgrade