問題描述:出現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