1. 首页
  2. Linux

Debian12 安装后首先应该做的事情-更换软件源

一、备份当前软件源

cp /etc/apt/sources.list /etc/apt/sources.list.bak

二、修改当前软件源

# 需要 root 权限
vim /etc/apt/sources.list

三、替换软件源内容

# 中科大镜像站
deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware

# 阿里云镜像站
deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib

# 腾讯云镜像站
deb https://mirrors.tencent.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.tencent.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.tencent.com/debian-security/ bookworm-security main
deb-src https://mirrors.tencent.com/debian-security/ bookworm-security main
deb https://mirrors.tencent.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.tencent.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.tencent.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.tencent.com/debian/ bookworm-backports main non-free non-free-firmware contrib

# 华为镜像站
deb https://mirrors.huaweicloud.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.huaweicloud.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.huaweicloud.com/debian-security/ bookworm-security main
deb-src https://mirrors.huaweicloud.com/debian-security/ bookworm-security main
deb https://mirrors.huaweicloud.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.huaweicloud.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.huaweicloud.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.huaweicloud.com/debian/ bookworm-backports main non-free non-free-firmware contrib

# 清华大学镜像站
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/ 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
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

# Debian官方维护镜像站
deb http://security.debian.org/debian-security bookworm-security main non-free-firmware
deb-src http://security.debian.org/debian-security bookworm-security main non-free-firmware

四、更新源

sudo apt update

五、扩展-关于软件源参数说明

1.deb 表示二进制软件包,指示系统下载已经编译好的软件包进行安装。这些二进制软件包包含了可以直接在系统上运行的可执行文件、库文件等。deb软件包适用于普通用户安装和使用。

2.deb-src 表示源代码软件包,指示系统下载软件的源代码。用户可以使用这些源代码进行编译、修改或分析,然后再生成可执行文件。deb-src软件包适用于开发人员、编译器和需要对软件进行定制或调试的用户。

3.bookworm是Debian的一个版本代号,通常用来指代Debian的下一个发行版。每个Debian版本都有一个代号,例如Debian 11的代号是Bullseye。在这个软件源中,bookworm指示这个源适用于Debian的bookworm版本,也就是Debian的下一个发行版。

4.主要软件库(main): 包含了由Debian项目维护的自由软件,这些软件遵守Debian自由软件指导方针,用户可以自由使用、修改和分发。

5.贡献软件库(contrib): 包含了由社区维护的自由软件,这些软件也遵守Debian自由软件指导方针,但是不属于Debian项目正式维护的软件。

6.非自由软件库(non-free): 包含了一些不完全符合Debian自由软件指导方针的软件,这些软件可能包含一些限制或专有内容,用户需要自行权衡是否使用这些软件。

7.非自由固件库(non-free-firmware): 包含了一些硬件设备的固件,这些固件可能包含专有内容或限制,这些固件通常用于支持硬件设备的正常运行。用户需要自行权衡是否使用这些固件。

六、扩展-把本地光盘当做源来使用

vim /etc/apt/sources.list
# 在第一行插入下行内容
deb [trusted=yes] file:///mnt/usb1 bookworm main non-free-firmware


# 挂载光盘
mkdir /mnt/usb1
mount /dev/sr0   /mnt/usb1



TOP