以下是Debian软件源配置指南:
备份原始文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
配置国内源(以清华源为例)
- 方法一:直接编辑
/etc/apt/sources.listsudo nano /etc/apt/sources.list将内容替换为(根据系统版本替换
bookworm等代号):deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware - 方法二:使用DEB822格式(推荐)
在/etc/apt/sources.list.d/目录下创建.sources文件,如debian.sources:sudo nano /etc/apt/sources.list.d/debian.sources添加内容:
Types: deb deb-src URIs: https://mirrors.tuna.tsinghua.edu.cn/debian Suites: bookworm bookworm-updates bookworm-security Components: main contrib non-free non-free-firmware Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
更新软件包列表
sudo apt update