Marco Nie - sources.list https://blog.niekun.net/tag/sources-list/ Ubuntu 修改 apt 国内源 https://blog.niekun.net/archives/1161.html 2020-02-26T13:25:00+08:00 国内使用 apt 安装软件如果感觉比较慢,可能是 deb 源是国外的,通过修改为国内源,可以很好的进行加速下载。系统代号每一个版本的 Ubuntu 都会有一个代号: codename,用来识别不同的版本,比如:14.04 LTS 代号是 trusty16.04 LTS 代号是 xenial18.04 LTS 代号是 bionic在更换源的时候需要使用到代号codename,可以使用如下命令查看当前系统版本代号:lsb_release -a 备份系统源文件为防止修改错误或其他问题,将系统自带源文件进行备份很有必要,执行如下指令:sudo cp /etc/apt/sources.list /etc/apt/sources.list_bak 修改 sources.list 源文件打开 sources.list 文件,将内容修改为想要的国内源:vim /etc/apt/sources.list 输入命令 ggdG 清空内容,修改为清华源加入如下内容:# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse # 预发布软件源,不建议启用 # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse可以看到每行内容里都有对应系统代号信息,如果要修改其他版本系统的 apt 源,只需要将里面系统代号替换即可。常用国内源:清华源:https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/阿里源:https://developer.aliyun.com/mirror/