- 本文地址: https://www.yangdx.com/2022/04/208.html
- 转载请注明出处
Debian 系统默认的 apt 源比较慢,修改为国内的镜像地址,可以加速下载。
可在文件 /etc/debian_version 记录着 Debian 的版本号:
$ cat /etc/debian_version
11.2
可知版本号是 11.2,然后去阿里云的 Debian 镜像站(https://developer.aliyun.com/mirror/debian)找到对应版本的镜像地址。
debian 11.x 的镜像地址是:
deb http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb http://mirrors.aliyun.com/debian-security/ bullseye-security main
deb-src http://mirrors.aliyun.com/debian-security/ bullseye-security main
deb http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
把上面的内容替换到 /etc/apt/sources.list
文件里即可(建议先备份)。
这里有个偷懒的方法,使用以下 sed 指令快速替换:
$ sed -i -E 's/(deb|security).debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
https://jingxiangmao.com/ 这个好用