Debian 12(Bookworm)apt 包管理器 国内源配置

Debian 12(Bookworm)apt 包管理器 国内源配置

Debian 12

Debian 12(Bookworm)采用 apt 作为包管理器。
有两种国内源配置方法。
!注意,在配置前,请先 sudo apt update

1. 自动配置

  1. 安装 netselect-apt
  2. 使用 sudo netselect-apt 命令,在 ~ 目录生成 source.list 文件。
  3. /etc/apt/source.list 备份到自己的备份目录下。
  4. 将生成的 source.list 文件复制到 /etc/apt 目录下。

2. 手动配置(Recommanded)

  1. /etc/apt/source.list 备份到自己的备份目录下。
  2. 重新创建 /etc/apt/source.list 文件,并按需求编辑文件。
// 这里采用中科大源,作为展示
deb https://mirrors.ustc.edu.cn/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main
deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib
//若有下载源码并编译安装的需求,可采用
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib

其中 main 为官方维护内容,non-free 为非自由软件, non-free-firware 为非自由驱动,contrib 为具有非自由依赖。
可自行选择。
3. 使用 sudo apt update 命令,更新 apt 。

posted @ 2025-08-09 19:37  Sota_Emon  阅读(440)  评论(0)    收藏  举报