Debian官方源因为墙的问题导致下载速度很慢,所以需要更换为国内的源。

一般情况下,将 /etc/apt/sources.list 文件中 Debian 默认的源地址 security.debian.org替换为国内的源地址即可,更换完源请执行apt update

方法一、使用sed命令

sed -i 's|security.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list

方法二、直接编辑

使用nano或者vi直接编辑sources.list文件后保存即可。

以下是一些国内常用源:

1、163

deb http://mirrors.163.com/debian/ bullseye main
deb-src http://mirrors.163.com/debian/ bullseye main
deb http://mirrors.163.com/debian-security/ bullseye-security main
deb-src http://mirrors.163.com/debian-security/ bullseye-security main
deb http://mirrors.163.com/debian/ bullseye-updates main
deb-src http://mirrors.163.com/debian/ bullseye-updates main

2、阿里云

deb http://mirrors.aliyun.com/debian/ bullseye main
deb-src http://mirrors.aliyun.com/debian/ bullseye main
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
deb-src http://mirrors.aliyun.com/debian/ bullseye-updates main

3、华为云

deb http://mirrors.huaweicloud.com/debian/ bullseye main
deb-src http://mirrors.huaweicloud.com/debian/ bullseye main
deb http://mirrors.huaweicloud.com/debian-security/ bullseye-security main
deb-src http://mirrors.huaweicloud.com/debian-security/ bullseye-security main
deb http://mirrors.huaweicloud.com/debian/ bullseye-updates main
deb-src http://mirrors.huaweicloud.com/debian/ bullseye-updates main

4、中科大

deb https://mirrors.ustc.edu.cn/debian/ bullseye main
deb-src https://mirrors.ustc.edu.cn/debian/ bullseye main
deb https://mirrors.ustc.edu.cn/debian-security/ bullseye-security main
deb-src https://mirrors.ustc.edu.cn/debian-security/ bullseye-security main
deb https://mirrors.ustc.edu.cn/debian/ bullseye-updates main
deb-src https://mirrors.ustc.edu.cn/debian/ bullseye-updates main

注意:使用 HTTPS 可以有效避免国内运营商的缓存劫持,需要安装 apt-transport-https,到但是Debian Buster(Debian 10)及以上版本不需要。

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。