lsb_release -c
查看版本号
标红地方为版本号,记住,我的是18.04,版本号为bionic
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
备份原来的文件
su root
#使用管理员登陆
vim /etc/apt/sources.list
#注释掉原有内容,添加下边的文字
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
注:上边的为阿里的源,根据自己的版本号替换其中…/ubuntu/后边的版本号即可
sudo apt-get update
#更新软件列表
sudo apt-get upgrade
#更新软件包
搞完收工