Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> 關於 Linux

Debian 安裝閉源軟件包完整指南:啟用 contrib non-free 倉庫

編輯:關於 Linux

Debian 堅持自由軟件原則,默認倉庫僅含開源軟件。安裝專有驅動、編解碼器、字體等閉源軟件需啟用 contrib 和 non-free 倉庫。本文詳述配置流程與最佳實踐。

倉庫分類解析

組件許可證內容示例是否 DFSG 合規
main自由軟件Linux 內核、GCC、systemd、大多數應用✅ 是
contrib自由但依賴非自由需專有固件的驅動、依賴非自由庫的構建工具✅ 是(但依賴非自由)
non-free非自由/專有NVIDIA 驅動、微軟字體、商業編解碼器、固件二進制❌ 否
non-free-firmware非自由固件硬件固件二進制(Debian 12+ 新增)❌ 否

配置步驟

1. 編輯軟件源

sudo vim /etc/apt/sources.list

2. 修改每行添加 contrib non-free

Debian 11 (Bullseye) 示例:

deb https://deb.debian.org/debian bullseye main contrib non-free
deb-src https://deb.debian.org/debian bullseye main contrib non-free

deb https://security.debian.org/debian-security bullseye-security main contrib non-free
deb-src https://security.debian.org/debian-security bullseye-security main contrib non-free

deb https://deb.debian.org/debian bullseye-updates main contrib non-free
deb-src https://deb.debian.org/debian bullseye-updates main contrib non-free

Debian 12 (Bookworm) 新增 non-free-firmware:

deb https://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb https://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware

3. 更新包索引

sudo apt update
# 或 aptitude 用戶
sudo aptitude update

驗證與搜索

# 搜索閉源包
apt search nvidia-driver
apt search firmware-linux

# 查看包屬於哪個組件
apt policy nvidia-driver
# 輸出含:500 https://deb.debian.org/debian bullseye/non-free amd64 Packages

典型閉源軟件安裝示例

需求安裝命令所需倉庫
NVIDIA 專有驅動sudo apt install nvidia-drivernon-free
微軟核心字體sudo apt install ttf-mscorefonts-installercontrib
無線網卡固件sudo apt install firmware-linux-nonfreenon-free / non-free-firmware
商業編解碼器sudo apt install gstreamer1.0-libavnon-free
VirtualBox 官方版sudo apt install virtualbox-6.1contrib (需添加官方源)

進階:第三方倉庫管理

# 添加官方 VirtualBox 倉庫
echo "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
sudo apt update && sudo apt install virtualbox-6.1

合規與安全提醒

  • ⚠️ non-free 軟件可能含專有許可限制,商業環境需審查合規性
  • ⚠️ 固件二進制不可審計,涉及供應鏈安全風險
  • ✅ 生產環境優先考慮開源替代方案
  • ✅ 使用 vrms (Virtual Richard M. Stallman) 檢測系統安裝的非自由軟件

合理配置軟件源,在自由原則與實用需求間找到平衡點。

Copyright © Windows教程網 All Rights Reserved