查看版本:
因为Ubuntu每个版本更新源不同 首先查看版本
#lsb_release -a
记录Codename,如hirsute
替换源的:
执行sudo gedit ‘/etc/apt/sources.list’
进入编辑器,将下面模板中的codename替换成自己版本的,然后复制进去并保存
# 阿里云源
deb http://mirrors.aliyun.com/ubuntu/ codename main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ codename-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ codename-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ codename-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ codename-proposed main restricted universe multiverse
# 源码
deb-src http://mirrors.aliyun.com/ubuntu/ codename main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ codename-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ codename-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ codename-backports main restricted universe multiverse
##测试版源
deb-src http://mirrors.aliyun.com/ubuntu/ codename-proposed main restricted universe multiverse
# 清华大学源
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ codename main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ codename-security main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ codename-updates main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ codename-backports main restricted universe multiverse
##测试版源
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ codename-proposed main restricted universe multiverse
# 源码
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ codename main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ codename-security main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ codename-updates main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ codename-backports main restricted universe multiverse
##测试版源
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ codename-proposed main restricted universe multiverse
更新:
保存后再次更新即可
sudo apt-get update
sudo apt-get upgrade