当前位置:首页 > 原创教程 > Debian11.5更换apt源

Debian11.5更换apt源

原创教程 / 星之宇 / 2022-10-25 14:25 / 浏览:275 / 评论:0

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)及以上版本不需要。

目前有 0 条评论

    • QQ
    • 填好QQ,点击获取自动填写昵称和邮箱
    • 昵称
    • 邮箱
    • 网址