将原来的进行备份
sudo cp /etc/apt/sources.list /etc/apt/sources_init.list
打开sources.list进行修改
sudo gedit /etc/apt/sources.list
将原内容全部删除(ctrl+a全选删除),(建议Ubuntu18.04)替换如下:
deb https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
# deb https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
保存后退出,执行:
sudo apt-get update
sudo apt-get upgrade
如想用其他国内镜像源,如下:
阿里云:
阿里巴巴开源镜像站-OPSX镜像站-阿里云开发者社区 (aliyun.com)
清华源:
ubuntu | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
中科大源:
Ubuntu 源使用帮助 — USTC Mirror Help 文档
注意自己的ubuntu版本