将 Debian 11 Bullseye 官方存储库添加到 sources.list

Eternal 发布于 2023-09-14 1350 次阅读 最后更新于 2023-09-14


在虚拟化基础设施或物理机上安装 Debian 11 Bullseye 后,您会发现 APT 存储库配置不正确。这些问题不适用于正确配置了 Debian 11 (Bullseye) 存储库的云映像。在本指南中,我们将向您展示如何将 Debian 11 Bullseye 官方存储库添加到 sources.list。

如果您尝试更新 APT 存储库,如运行 sudo apt update,会报错。解决此问题的方法是使用 Debian 11 (Bullseye) 默认更新和安全存储库正确更新 resources.list 文件。

当前文件内容:

cat /etc/apt/sources.list
# deb cdrom:[Debian GNU/Linux 11.0.0 _Bullseye_ - Official amd64 DVD Binary-1 20210814-10:04]/ bullseye contrib main

deb cdrom:[Debian GNU/Linux 11.0.0 _Bullseye_ - Official amd64 DVD Binary-1 20210814-10:04]/ bullseye contrib main

deb http://security.debian.org/debian-security bullseye-security main contrib
deb-src http://security.debian.org/debian-security bullseye-security main contrib

# bullseye-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
# A network mirror was not selected during install.  The following entries
# are provided as examples, but you should amend them as appropriate
# for your mirror of choice.
#
# deb http://deb.debian.org/debian/ bullseye-updates main contrib
# deb-src http://deb.debian.org/debian/ bullseye-updates main contrib

将 Debian 11 Bullseye 官方存储库添加到 sources.list,运行以下命令直接回车即可:

sudo tee /etc/apt/sources.list<<EOF
deb http://deb.debian.org/debian bullseye main
deb-src http://deb.debian.org/debian bullseye main

deb http://security.debian.org/debian-security bullseye-security main
deb-src http://security.debian.org/debian-security bullseye-security main

deb http://deb.debian.org/debian bullseye-updates main
deb-src http://deb.debian.org/debian bullseye-updates main

deb http://deb.debian.org/debian bullseye-backports main
deb-src http://deb.debian.org/debian bullseye-backports main
EOF

完成后,更新您的 APT 索引以确认存储库正常工作:

sudo apt update

添加官方操作系统存储库并确认其正常工作后,让我们更新系统软件包:

sudo apt upgrade

如果可用,您还可以尝试发行版小幅升级:

sudo apt dist-upgrade

如果需要,可以安装常用的操作系统管理工具:

sudo apt install git curl bash-completion wget curl vim telnet -y

现在,您的 Debian 11 (Bullseye) 系统上已拥有正确的 sources.list 文件。

此作者没有提供个人介绍
最后更新于 2023-09-14