-
备份原来的源
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
-
更换源
sudo vi /etc/apt/sources.list
将下边的阿里源复制进去
阿里源(Ubuntu 18.04):
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
强烈建议:在软件源列表sources.list(该文本的位置在/etc/apt/sources.list)文件中的末尾添加如下内容:
deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse
- 更新源
sudo apt-get update
==================== 分割线 ==========================
- (可选)修复损坏的软件包,尝试卸载出错的包,重新安装正确版本:
sudo apt-get -f install
- (可选)更新软件:
sudo apt-get upgrade
==================== 分割线 ==========================
参考并感谢:Ubuntu 更换国内源