Debian 12 “Bookworm” 安裝完成后更新配置
? ? ? ? ??

? ? ? ?當你自己已經(jīng)安裝好了 Debian 12 “Bookworm” 或者?準備升級?了。Debian 12 經(jīng)過一年多的開發(fā),于 2023 年 6 月 10 日發(fā)布。它帶來了最新的軟件包、升級和替換一些關鍵模塊。請在此查看 Debian 12 的一些新特性?指南。
? ? ? ?如果你在筆記本電腦或臺式機上使用 Debian,那么在安裝或升級到 Debian 12 后,以下是你可能需要完成的一些步驟。
Debian 12 安裝后需要做的幾件事情
啟用 sudo
? ? ? ? 如果你將 Debian 12 作為新安裝的系統(tǒng),那么你的用戶賬戶可能沒有超級用戶訪問權限。出于安全原因,Debian 在安裝期間不允許任何選項給予用戶賬戶 sudo 訪問權限。以下是如何將用戶添加到超級用戶組。
打開終端并使用 root 密碼進入 root 賬戶。
su
然后運行以下命令,將你的用戶賬戶添加到?sudo
?組。請將下面的用戶名更改為你的賬戶。
/sbin/addgroup 用戶名 sudo
現(xiàn)在,你可以注銷并再次登錄該賬戶。
確保 Debian 已更新至最新版本
在開始工作或進行任何配置之前,確保 Debian 12 已更新至最新版本非常重要。從終端中按以下順序運行以下命令以刷新 Debian 系統(tǒng)。
sudo apt update sudo apt upgrade
Debian 12 中的非自由軟件
Debian 12 中有一個關于管理“非自由”固件包的根本變化。Debian 創(chuàng)建了一個新的軟件源,以便輕松訪問那些專有包。因此,如果你想添加非自由軟件包,需要確保在 APT 軟件源文件?/etc/apt/sources.list
?中添加以下行:
sudo nano /etc/apt/sources.list deb http://deb.debian.org/debian bookworm non-free non-free-firmware deb-src http://deb.debian.org/debian bookworm non-free non-free-firmware deb http://deb.debian.org/debian-security bookworm-security non-free non-free-firmware deb-src http://deb.debian.org/debian-security bookworm-security non-free non-free-firmware deb http://deb.debian.org/debian bookworm-updates non-free non-free-firmware deb-src http://deb.debian.org/debian bookworm-updates non-free non-free-firmware
保存并關閉文件。然后刷新 Debian 系統(tǒng)。完成后,你現(xiàn)在可以安裝“非自由”軟件包。
換國內(nèi)源,速度更加流暢:

Debian 軟件倉庫鏡像使用幫助
是否使用 HTTPS??是?否?
是否使用 sudo??是?否?
一般情況下,將?/etc/apt/sources.list
?文件中 Debian 默認的源地址?http://deb.debian.org/
?替換為鏡像地址即可。
Debian Buster 以上版本默認支持 HTTPS 源。如果遇到無法拉取 HTTPS 源的情況,請先使用 HTTP 源并安裝:
sudo apt install apt-transport-https ca-certificates
Debian 版本:??Debian 12 (bookworm)?Debian 11 (bullseye)?sid?testing?Debian 10 (buster)?
啟用源碼鏡像:??否?是?
使用官方安全更新軟件源:??是?否?
# 默認注釋了源碼鏡像以提高 apt update 速度,如有需要可自行取消注釋deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmwaredeb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmwaredeb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware# deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware# # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmwaredeb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware# deb-src https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
不過,一般來說,為了更及時地獲得安全更新,不推薦使用鏡像站安全更新軟件源,因為鏡像站往往有同步延遲。參考 https://www.debian.org/security/faq.en.html#mirror
The purpose of security.debian.org is to make security updates available as quickly and easily as possible.
Encouraging the use of unofficial mirrors would add extra complexity that is usually not needed and that can cause frustration if these mirrors are not kept up to date.
Connection reset by peer
在 apt 2.1.9 及以后的版本中,apt 的 HTTP Pipelining 特性與 Nginx 服務器疑似存在一定的不兼容問題,可能導致高帶寬從鏡像站下載大量軟件包 (例如系統(tǒng)升級)時出現(xiàn)偶發(fā)的 Connection reset by peer 錯誤 (詳見?Debian bug #973581)。
目前,用戶可以通過關閉 HTTP Pipelining 特性解決此問題。 如果需要關閉,可以在使用?apt
?命令時加上?-o Acquire::http::Pipeline-Depth=0
?參數(shù), 或使用以下命令將相關設置加入 apt 系統(tǒng)配置中:
echo "Acquire::http::Pipeline-Depth \"0\";" > /etc/apt/apt.conf.d/99nopipelining
sudo apt update
安裝額外的桌面環(huán)境
Debian Linux 提供了所有主要的桌面環(huán)境包。如果你使用 Debian 的 Netinst ISO 文件(最小化 ISO 鏡像)進行安裝,那么你可能已經(jīng)獲得了默認的 Xfce 桌面環(huán)境。在 Debian 12 安裝期間,你可以選擇桌面環(huán)境。
如果你想安裝任何額外的桌面環(huán)境,則可以使用各種軟件包管理器進行安裝?;蛘?,獲取專用的 ISO 文件。從 Debian 12 開始,團隊為每個桌面提供單獨的 ISO 文件。你可以在以下鏈接中獲取它們。
amd64 – 種子(GNOME、KDE Plasma、Xfce、LXQt、LXDE、MATE 和 Cinnamon)
直接下載 ISO 文件(GNOME、KDE Plasma、Xfce、LXQt、LXDE、MATE 和 Cinnamon)
設置 Flatpak 和 Flathub
你應該在 Debian 中?設置 Flatpak,以便從 Flathub 獲取數(shù)百款最新的應用程序。要設置它,可以從終端中運行以下命令。
sudo apt install flatpak
如果你想通過瀏覽器安裝 Flatpak 應用程序,則以下軟件包是可選的。
sudo apt install gnome-software-plugin-flatpak
添加 Flathub 軟件源庫,其中包含所有 Flatpak 應用程序。從終端中運行以下命令。
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
重新啟動 Debian 系統(tǒng)就可以使用 Flatpak 應用程序了。
安裝最新的 Firefox
Debian Linux 附帶的是 Firefox ESR 版本,這個版本的功能略舊。不過它非常穩(wěn)定和安全。如果你想?安裝最新版本的 Firefox,可以從以下官方網(wǎng)站下載預編譯的二進制文件,并執(zhí)行?firefox
。
下載 Firefox
安裝額外的軟件 – 圖形界面
默認的 Debian 安裝只有非常簡潔的圖形界面應用程序。為了配置你的工作站,你可以考慮安裝以下一組應用程序。但是,以下列表非?;?,對于基本用例應該是足夠的。
它們包括分區(qū)軟件、BT 客戶端、媒體播放器和圖形實用工具。
sudo apt install gparted transmission-gtk vlc pavucontrol geany gimp inkscape audacity filezilla leafpad
安裝額外的軟件 – 命令行界面
雖然上述圖形界面應用程序是必要的,但是你應該始終安裝一些超級重要的命令行實用工具。以下是我為你準備的列表。
sudo apt install ffmpeg default-jdk git wget nano vim htop locate p7zip p7zip-full unzip
Debian 12 中的替代包
如果你正在運行 Debian 服務器或桌面系統(tǒng),你應該注意本版本中一些關鍵軟件包已被替換。以下是其中的一些:
默認系統(tǒng)時鐘現(xiàn)在由?
systemd-timesyncd
?管理,ntp
?已被?ntpsec
?替換。DNS 選項?
dnssec-enable
?已經(jīng)過時。如果遇到無效選項錯誤,請在?named.conf
?文件中注釋該行(應該在?/etc
?或?/etc/bind9
?中)。不會自動安裝?
systemd-resolved
?包。你需要手動安裝和啟動它。rsyslog
?包不會默認安裝,因為?journalctl
?接管了該功能。
配置 Debian 多媒體倉庫

由社區(qū)創(chuàng)建的流行 Debian 多媒體倉庫已更新為 Bookworm 版本。你可以在 APT 軟件源文件中添加以下行,并利用數(shù)百個多媒體軟件包來完成你的項目。
deb https://www.deb-multimedia.org bookworm main non-free
你可以訪問?官方頁面?以了解有關該軟件源庫的更多信息。
參考來源:
Debian 12 “Bookworm” 安裝完成后需要做的 10 件事 | Linux 中國 - 知乎 (zhihu.com)
debian | 鏡像站使用幫助 | 清華大學開源軟件鏡像站 | Tsinghua Open Source Mirror
Debian GNU/Linux 安裝手冊
lauosc社區(qū) debian 12 ports 項目啟動 - LA UOSC (loongarch.org)