1.查看版本代号:
使用如下命令:
lsb_release -c
得到本系统的系统代号
Ubuntu 14.04 (LTS)代号为trusty。
Ubuntu 16.04 (LTS)代号为xenial
Ubuntu 18.04 (LTS)代号为bionic
2.备份源文件
命令如下:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
3.编辑源列表文件
使用命令:
sudo vim /etc/apt/sources.list
如果报错:sudo:vim:command not found 说明没装vim编辑器
使用命令:
sudo apt-get install vim 安装即可
4.更换源
原有内容全部注释,添加
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
5.更新软件列表
运行如下命令:
sudo apt-get update
6.更新软件包
运行如下命令:
sudo apt-get upgrade
网友评论