前言

本来debian在安装的时候就可以选择国内的源,本来我以为这样就行了,不用自己在手动换,结果今天在使用更新命令时就给我卡住了,开始请求官方源了。

难崩,还得自己换源解决问题。

教程

我们需要打开源文件:/etc/apt/sources.list ,你可以使用nano编辑或者ssh软件自带的文件管理功能修改文件。

将里面 debdep-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

# bookworm-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports
# 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/ 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

粘贴到sources.list文件内后保存,然后调用命令:sudo apt update 重新拉一下索引文件。

然后就可以使用 sudo apt-get upgrade更新依赖了。

Last modification:November 29, 2024
如果觉得我的文章对你有用,请随意赞赏