1、备份原始的软件源
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
2、从以下镜像点找到合适自己系统版本的源
清华源https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/
中科大源
Ubuntu - USTC Mirror Helphttps://mirrors.ustc.edu.cn/help/ubuntu.html#__tabbed_4_3例如,清华源
通过gedit编辑器编辑sources.list
sudo gedit /etc/apt/sources.list
将原来里面的内容删除,替换为适合自己的源(以下是Ubuntu20.04的清华源) ,并保存
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
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 http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
3、更新系统的软件源
sudo apt-get update