从 Debian 9 (stretch) 升级到 Debian 11 (bullseye)。

先确认下自己的 Debian 版本:

$ cat /etc/debian_version

因为不支持从 10 之前的版本直接升级到 11,所以需要先升级到 Debian 10 (buster)。

意味着下面的步骤需要执行两遍,注意替换 codename

# First, ensure your system is up-to-date in it's current release.
$ sudo apt update
$ sudo apt upgrade

# If you haven't already, ensure all backups are up-to-date.  

# In a text editor, replace the codename of your release with that of the next release in APT's package sources
# For instance, the line
#    deb https://deb.debian.org/debian/ buster main
# should be replaced with
#    deb https://deb.debian.org/debian/ bullseye main
$ sudo nano /etc/apt/sources.list /etc/apt/sources.list.d/*

# Clean and update package lists
$ sudo apt clean
$ sudo apt update

# Perform the major release upgrade, removing packages if required
# Interrupting this step after downloading has completed is an excellent way to stress-test your backups
$ sudo apt full-upgrade

# Remove packages that are not required anymore
# Be sure to review this list: you may want to keep some of them
$ sudo apt autoremove

# Reboot to make changes effective (optional, but recommended)
$ sudo shutdown -r now

完成后可以使用 uname -alsb_release -a 查看关于升级后的系统的信息。

References: