跳到主要内容

Debian 发行版对照

版本名及内核版本

更多可参考官方页面Debian 发行版本

版本号版本名内核版本
7.xWheezy3.2.x
8.xJessie3.16.x
9.xStretch4.9.x
10.xBuster4.19.x
11.xBullseye5.10.x
12.xBookworm6.1.x
13.xTrixie待定

查看系统版本

有以下多种方式查看当前系统版本信息:

~ cat /etc/debian_version
12.5

~ 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/"

~ cat /proc/version
Linux version 6.1.0-18-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01)

~ uname -a
Linux h1501359791275118982 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux

~ lsb_release -a # 需要安装 lsb-release 包,apt install lsb-release
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm

~ cat /etc/issue
Debian GNU/Linux 12 \n \l

快速换源

Jessie

# 1. 备份当前源列表
cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 2. 创建新的源列表
cat > /etc/apt/sources.list << EOF
deb http://mirrors.aliyun.com/debian/ jessie main non-free contrib
deb http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ jessie main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib
EOF
# 3. 更新软件包列表
apt update

Stretch

# 1. 备份当前源列表
cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 2. 创建新的源列表
cat > /etc/apt/sources.list << EOF
deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
EOF
# 3. 更新软件包列表
apt update

Buster

# 1. 备份当前源列表
cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 2. 创建新的源列表
cat > /etc/apt/sources.list << EOF
deb http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb http://mirrors.aliyun.com/debian-security buster/updates main
deb-src http://mirrors.aliyun.com/debian-security buster/updates main
deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
EOF
# 3. 更新软件包列表
apt update

Bullseye

# 1. 备份当前源列表
cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 2. 创建新的源列表
cat > /etc/apt/sources.list << EOF
deb http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb http://mirrors.aliyun.com/debian-security/ bullseye-security main
deb-src http://mirrors.aliyun.com/debian-security/ bullseye-security main
deb http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
EOF
# 3. 更新软件包列表
apt update

Bookworm

# 1. 备份当前源列表
cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 2. 创建新的源列表文件
cat > /etc/apt/sources.list << EOF
deb https://mirrors.aliyun.com/debian bookworm main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian bookworm-proposed-updates main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian bookworm-backports main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian bookworm-backports-sloppy main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian bookworm-proposed-updates main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian bookworm-backports-sloppy main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian-security bookworm-security main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian-security bookworm-security main non-free non-free-firmware contrib
EOF
# 3. 更新软件包列表
apt update

使用官方源

适用于国外服务器(国外到国外,天然友好)

# 1. 备份当前源列表
cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 2. 创建新的源列表文件
cat > /etc/apt/sources.list << EOF
# 官方软件源
deb http://deb.debian.org/debian bookworm main non-free non-free-firmware contrib
deb http://deb.debian.org/debian bookworm-updates main non-free non-free-firmware contrib
deb http://deb.debian.org/debian bookworm-proposed-updates main non-free non-free-firmware contrib
deb http://deb.debian.org/debian bookworm-backports main non-free non-free-firmware contrib
deb http://deb.debian.org/debian bookworm-backports-sloppy main non-free non-free-firmware contrib
deb-src http://deb.debian.org/debian bookworm main non-free non-free-firmware contrib
deb-src http://deb.debian.org/debian bookworm-updates main non-free non-free-firmware contrib
deb-src http://deb.debian.org/debian bookworm-proposed-updates main non-free non-free-firmware contrib
deb-src http://deb.debian.org/debian bookworm-backports main non-free non-free-firmware contrib
deb-src http://deb.debian.org/debian bookworm-backports-sloppy main non-free non-free-firmware contrib
# 官网安全更新源
deb http://deb.debian.org/debian-security bookworm-security main non-free non-free-firmware contrib
deb-src http://deb.debian.org/debian-security bookworm-security main non-free non-free-firmware contrib
EOF
# 3. 更新软件包列表
apt update

源的构成与查找

关于源的构成与查找,详情可以参考官方文档

这里以Debian 阿里云源为例,其中以bookworm为例,其源的语法如下:

deb https://mirrors.aliyun.com/debian bookworm main non-free non-free-firmware contrib

其中各个部分的含义如下:

  • deb:表示这是一个二进制软件包源,适用于大多数用户。如果是源代码包,则使用deb-src
  • https://mirrors.aliyun.com/debian:表示软件包的镜像地址
  • bookworm:表示软件包的版本(系统代号,水平划分)
  • main non-free non-free-firmware contrib:表示要安装的组件,这里包括了主要的软件包、非免费软件包、非免费固件包和贡献软件包(软件分支/垂直划分)
备注
  • 水平划分:每个Linux系统的某个版本都有其对应的代号,而该代号版本的系统的所有软件包通常会先按照功能水平划分,例如Debian的bullseye代号下所有软件包先被水平划分为了5个类别:bullseye、bullseye-updates、bullseye-proposed-updates、bullseye-backports和bullseye-backports-sloppy,水平划分部分可以在软件源网址中的dists目录中看到,当然不是每个系统的软件包都会水平划分,例如Deepin 20的软件包就没有进行水平划分,那么就直接在dists中找到其版本代号即可
  • 垂直划分:每个水平划分下的软件包通常又会根据软件包自由程度进行垂直划分,而通常一个系统中的每个水平划分下的垂直划分都是一样的。例如Debian中每个水平划分下都垂直划分为了3类:main、contrib和non-free,在软件源网址中的pool目录中可以看到垂直划分

知道了当前系统版本代号之后,我们可以先在浏览器打开镜像源地址,打开后通常是目录形式,在里面我们可以找到所有软件包,进入其中的dists文件夹,在里面可以看到所有的系统代号(这个目录中存放的是每个系统代号对应的软件列表索引):

debian-source-aliyun1

选择bookworm,可以看到主要软件包及水平划分主要有5类

bookworm/
bookworm-backports/
bookworm-backports-sloppy/
bookworm-proposed-updates/
bookworm-updates/

这些都需要配置到源中,内容如下:

deb https://mirrors.aliyun.com/debian bookworm
deb https://mirrors.aliyun.com/debian bookworm-updates
deb https://mirrors.aliyun.com/debian bookworm-backports
deb https://mirrors.aliyun.com/debian bookworm-backports-sloppy
deb https://mirrors.aliyun.com/debian bookworm-proposed-updates
deb-src https://mirrors.aliyun.com/debian bookworm
deb-src https://mirrors.aliyun.com/debian bookworm-updates
deb-src https://mirrors.aliyun.com/debian bookworm-backports
deb-src https://mirrors.aliyun.com/debian bookworm-backports-sloppy
deb-src https://mirrors.aliyun.com/debian bookworm-proposed-updates

然后再来配置软件分支/垂直划分,打开阿里镜像源pool目录,这个目录用于存放所有软件包

debian-source-aliyun2

如图,pool中有四个目录,这几个目录就代表着Debian三个软件的垂直划分

  • main Debian中符合自由软件规范的软件包
  • contrib 本身属于自由软件但是可能部分依赖非自由软件的软件包
  • non-free 非自由软件
  • non-free-firmware 包含非自由固件的软件包(debian 12新增)

如果要确认特定系统代号的软件分支/垂直划分,也可以进入阿里镜像源dists/bookworm目录,里面有各个软件分支/垂直划分的索引文件

debian-source-aliyun3

因此,对于bookworm系统代号,完整的源配置如下:

# 阿里镜像源
deb https://mirrors.aliyun.com/debian bookworm main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian bookworm-proposed-updates main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian bookworm-backports main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian bookworm-backports-sloppy main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian bookworm-proposed-updates main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian bookworm-backports-sloppy main non-free non-free-firmware contrib
# 阿里安全更新镜像源
deb https://mirrors.aliyun.com/debian-security bookworm-security main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian-security bookworm-security main non-free non-free-firmware contrib