1. 查看/etc/os-release
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
得知os-release下,debian版本号为12,
从debian12开始,软件源的配置文件都变更为了为 DEB822 格式,路径变更为 /etc/apt/sources.list.d/debian.sources
2.更改配置
Debian修改软件镜像源为清华镜像源
# 1.找到新版本的镜像源的配置文件,在sources.list.d中的debian.sources
cd /etc/apt/sources.list.d
# 2.备份
mv /etc/apt/sources.list.d/debian.sources /etc/apt/sources.list.d/debian.sources.bak
# 3.清空文件夹
# 默认没有vim,我们使用echo来写入文件
echo "" > debian.sources
# 4.写入清华镜像源
# 注意引号是英文的""
echo "Types: deb
URIs: https://mirrors.tuna.tsinghua.edu.cn/debian
Suites: bookworm bookworm-updates bookworm-backports
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
Types: deb
URIs: https://security.debian.org/debian-security
Suites: bookworm-security
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg" > debian.sources
3. 更新apt
# 更新apt
$ apt-get update
$ apt-get upgrade
# 安装vim
$ apt-get install vim