1、备份原文件
cp /etc/apt/sources.list /etc/apt/sources.list.bak
2、清空 sources.list 文件中的内容,然后将以下任何一个源复制到文件中,以阿里源为例:
vim /etc/apt/sources.list deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse #保存退出 :wq
3、更新源
apt-get update apt-get upgrade
4.1 阿里源
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
4.2 清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
4.3 中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-security main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-security main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
4.4 网易163源
deb http://mirrors.163.com/ubuntu/ jammy main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ jammy-security main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ jammy-updates main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ jammy-proposed main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ jammy-backports main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ jammy main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ jammy-security main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ jammy-updates main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ jammy-proposed main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ jammy-backports main restricted universe multiverse
5、可能出现的错误
Ubuntu 404 Not Found [IP: 91.189.95.85 80]
这个错误有可能是你的网络运营商拦截了,这个很坑。
我当初遇到这个问题后,尝试了网上的各种办法都没解决,我的宽带是联通的,最后切换到移动网络,顺利解决!
package has no installation candidate
这个错误就是你的源出问题了,尝试:apt-get update,如果不行就按上面的步骤切换一下源。
标签:LTS,universe,restricted,jammy,22.04,Ubuntu,main,multiverse,ubuntu From: https://www.cnblogs.com/hunttown/p/17352465.html