你问的应该是 “在哪里 / 如何更换 Debian 的软件源(软件仓库)”。下面分几种常见情况说明。
Debian 的软件源主要配置在:
/etc/apt/sources.list
以及:
/etc/apt/sources.list.d/
(该目录下的 .list 文件也会被 apt 读取)
sudo nano /etc/apt/sources.list
例如,把官方源换成清华源(Debian 12 bookworm):
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free
保存后执行:
sudo apt update
很多国内镜像站提供一键生成:
按页面提示复制内容替换即可。
例如使用 sed 替换官方源为镜像源(示例):
sudo sed -i 's|deb.debian.org|mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list
sudo apt update
sudo apt update
如果你说的是:
可以告诉我具体场景,我给你更精确的方案。