引用:https://blog.csdn.net/u012308586/article/details/102953882
第一步、sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak 备份
文件里内容大概是这样:
第二步、修改源文件source.list
- 终端执行命令:sudo chmod 777 /etc/apt/sources.list更改文件权限使其可编辑;
- 执行命令:sudo gedit /etc/apt/sources.list打开文件进行编辑;
- 删除原来的文件内容,复制下面的任意一个到其中并保存(常用的是阿里源和清华源,推荐阿里源);
阿里源:
1 deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse 2 3 deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse 4 5 deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse 6 7 deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse 8 9 deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse 10 11 deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse 12 13 deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse 14 15 deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse 16 17 deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse 18 19 deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
清华源:
1 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse 2 3 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse 4 5 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse 6 7 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse 8 9 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse 10 11 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse 12 13 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse 14 15 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse 16 17 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse 18 19 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
163源:
1 deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse 2 3 deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse 4 5 deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse 6 7 deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse 8 9 deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse 10 11 deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse 12 13 deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse 14 15 deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse 16 17 deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse 18 19 deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
第三步、更新源
终端执行命令:sudo apt update更新软件列表,换源完成。