Debian11 bullseye 软件源配置

2026-09-10 19:34:00
丁国栋
原创 174
摘要:本文记录如何在Debian11中使用软件源。

Debian11的官方软件源最近被加入了归档,原来在 debian或者debian-security里的包被移到了 debian-archive。根据官网提供的信息看,LTS 支持在 2026-08-31 已经结束。如果还是使用原来的软件源(例如 apt update 或者 apt install)会提示无法找到,或者类似如下信息:

E: Release file for http://mirrors.xxxx.com/debian-security/dists/bullseye-security/InRelease is expired (invalid since 3d 4h 19min 35s). Updates for this repository will not be applied.

提示Release文件已经过期,无法更新。


如果是腾讯云可以如下更改:

cat > /etc/apt/sources.list <<EOF
# https://mirrors.cloud.tencent.com/help/debian.html
deb http://mirrors.tencent.com/debian-archive/debian bullseye main contrib non-free
deb http://mirrors.tencent.com/debian-archive/debian bullseye-updates main contrib non-free
EOF

如果是 Dockerfile ,可以这样写:

FROM debian:11.3-slim
RUN cat > /etc/apt/sources.list <<EOF
# https://mirrors.cloud.tencent.com/help/debian.html
deb http://mirrors.tencent.com/debian-archive/debian bullseye main contrib non-free
deb http://mirrors.tencent.com/debian-archive/debian bullseye-updates main contrib non-free
EOF
RUN apt-get -o Acquire::https::Verify-Peer=false -o Acquire::https::Verify-Host=false update \
  && apt-get -o Acquire::https::Verify-Peer=false -o Acquire::https::Verify-Host=false install ca-certificates -y \
  && apt-get clean && rm -rf /var/lib/apt/lists/* && rm -rf /var/tmp/*

其他Debian版本的更新

从 https://mirrors.tencent.com/debian-archive/debian/dists/ 页面显示的内容来看,有bullseye、buster、jessie等旧版本代号,所以其他Debian版本的软件源也可以用。

sed -i.bak -r 's@(deb|security).debian.org@mirrors.tencent.com/debian-archive@g' /etc/apt/sources.list # 外网地址
sed -i.bak -r 's@(deb|security).debian.org@mirrors.tencentyun.com/debian-archive@g' /etc/apt/sources.list # 内网地址
注:

mirrors.tencent.com #腾讯云镜像外网地址
mirrors.tencentyun.com #腾讯云镜像内网地址

---

发表评论
博客分类