问题描述:出现Failed to fetch http://…..
问题原因:一般是由于直接使用国外的源无法连接的原因导致的
解决方案:直接替换成国内的源即可
(1)执行备份命令:sudo cp /etc/apt/sources.list /etc/apt/sources.list.old
(2)打开文件:sudo vim /etc/apt/sources.list
(3)换源:复制源覆盖文件原来的内容(根据自己的网去尝试,选择最快的一个)
(4)更新源:sudo apt update 如果出现依赖问题-->sudo apt -f install
(5)更新软件:sudo apt upgrade
以下是ubuntu20.04版本软件源 [另附其他版本地址:阿里云开源镜像站: http://mirrors.aliyun.com/]
[清华大学:http://mirrors.tuna.tsinghua.edu.cn/ (IPv4+IPv6)]
[中科大:http://mirrors.ustc.edu.cn/ (IPv4+IPv6)]
#添加阿里源
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
#添加清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse multiverse