个人经历分享:Debian 12 换源与更新依赖插图

前言:选择的迷惑

在安装Debian 12时,我们通常可以选择国内的软件,我本以为这样就足够了,无需手动更换。然而,今天在执行更新命令时,系统竟然卡住了,原因是它开始请求官方了。突如其来的问题,令人感到有些为难,但好在我们可以通过手动更换来解决。

解决问题的教程:手动更换Debian 12软件

首先,我们需要打开文件:/etc/apt/sources.list。你可以选择使用nano编辑器或者通过SSH软件自带的文件管理功能进行修改。接着,将文件中的所有debdeb-src行都注释掉,即在每行前面加上#号,示例如下:

# deb http://mirrors.ustc.edu.cn/debian/ bookworm main non-free-firmware
# deb-src http://mirrors.ustc.edu.cn/debian/ bookworm main non-free-firmware
# 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
# deb http://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free-firmware
# deb-src http://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free-firmware

然后,插入你喜欢的新。我个人比较喜欢中科大的,所以这里给出一份示例:

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-backports/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian-backports/ 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

保存后,运行命令:sudo apt-get upgrade重新拉取一下索引文件,这样就可以使用sudo apt-get upgrade来更新依赖了。

其他:腾讯、阿里、网易选择

除了中科大的外,还有其他一些备选可供选择,这取决于个人偏好。以下是一些腾讯、阿里和网易的

腾讯

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-backports/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.tencent.com/debian-backports/ bookworm-backports main non-free non-free-firmware contrib

阿里

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-backports/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian-backports/ bookworm-backports main non-free non-free-firmware contrib

网易

deb https://mirrors.163.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.163.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.163.com/debian-security/ bookworm-security main
deb-src https://mirrors.163.com/debian-security/ bookworm-security main
deb https://mirrors.163.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.163.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.163.com/debian-backports/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.163.com/debian-backports/ bookworm-backports main non-free non-free-firmware contrib