在繼續進行操作之前,請確保對所有重要文件進行本地備份,升級可能會失敗,并且服務器將無法使用!
升級實際上取決于在系統上執行的自定義和安裝的軟件數量。附加軟件的數量越多,需要手動解決的軟件包沖突風險就越高。
1.準備
在繼續之前,系統需要獲取軟件包的所有未決更新。如果您最近沒有安裝更新,則可能需要一些時間。
由于依賴關系而已安裝且不再需要的軟件包也應刪除。
:~#apt-get update && apt-get upgrade -y
:~#apt-get autoremove
2.調整apt.conf(Debian)
以下命令將在任何存儲庫條目中將“ stretch”替換為“ buster”。
如果您手動添加了其他存儲庫,而這些存儲庫可能會失敗,則必須手動調查或禁用那些軟件包源。
:~#sed -i ‘s/stretch/buster/g’ /etc/apt/sources.list
:~#sed -i ‘s/stretch/buster/g’ /etc/apt/sources.list.d/*
通常,不應配置其他軟件包源,并且您的源列表將具有以下配置:
:~# cat /etc/apt/sources.list
deb http://asi-fs-n.contabo.net/Debian buster main non-free contrib
deb http://security.Debian.org/Debian-security buster/updates main contrib non-free
deb-src http://security.Debian.org/Debian-security buster/updates main contrib non-free
deb http://asi-fs-n.contabo.net/Debian buster-updates main contrib non-free
3. a)開始升級(Debian)
以下命令將開始升級,也將更新軟件包。
:~#apt clean && apt update
:~# apt upgrade -y
:~# apt dist-upgrade -y
:~# apt autoremove
:~# cat /etc/os-release
PRETTY_NAME=”Debian GNU/Linux 10 (buster)”
VERSION_ID=”10″
VERSION=”10 (buster)”
VERSION_CODENAME=buster
ID=Debian
HOME_URL=”https://www.Debian.org/”
SUPPORT_URL=”https://www.Debian.org/support”
bug_REPORT_URL=”https://bugs.Debian.org/”
3. b)開始升級(Ubuntu)
Ubuntu為此目的提供了一個工具/命令:“ do-release-upgrade”,它將更新到下一個可用的LTS版本,因此從14.04 LTS到16.04或從16.04 LTS到18.04 LTS。
如果找不到該命令并且缺少該工具,則可以使用以下命令進行安裝:
:~# apt-get install update-manager-core
4.重新啟動服務器
為了使用最近安裝的內核,您將必須重新引導服務器。重新啟動后,您正在運行最新版本的Debian(穩定)/ Ubuntu LTS。