| 元件 | 授權 | 說明 | 範例 |
| main | DFSG 相容 | 核心專案一部分 | Linux 核心、GCC、GNOME、Apache |
| contrib | DFSG 相容 | 建構/執行依賴 non-free | 需專有固件的驅動、某些遊戲引擎 |
| non-free | 非 DFSG | 可重新分發但非自由 | NVIDIA 驅動、Flash、微軟字型、解碼器 |
修改 /etc/apt/sources.list (以 Debian 7 Wheezy 為例)
# 備份原檔
cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 編輯
vi /etc/apt/sources.list
# 每行 deb/deb-src 後加入 "contrib non-free"
deb https://ftp.us.debian.org/debian/ wheezy main contrib non-free
deb-src https://ftp.us.debian.org/debian/ wheezy main contrib non-free
deb https://security.debian.org/ wheezy/updates main contrib non-free
deb-src https://security.debian.org/ wheezy/updates main contrib non-free
# wheezy-updates (原 volatile)
deb https://ftp.us.debian.org/debian/ wheezy-updates main contrib non-free
deb-src https://ftp.us.debian.org/debian/ wheezy-updates main contrib non-free
更新套件索引並搜尋安裝
# 更新索引
sudo apt-get update
# 或 aptitude
sudo aptitude update
# 搜尋非自由套件
apt-cache search nvidia | grep non-free
aptitude search '~s non-free'
# 安裝範例:NVIDIA 專有驅動
sudo apt-get install nvidia-driver
# 安裝範例:微軟核心字型
sudo apt-get install ttf-mscorefonts-installer
現代 Debian (8 Jessie 以降) 建議寫法
# /etc/apt/sources.list
deb https://deb.debian.org/debian/ stable main contrib non-free
deb-src https://deb.debian.org/debian/ stable main contrib non-free
deb https://security.debian.org/debian-security stable/updates main contrib non-free
deb-src https://security.debian.org/debian-security stable/updates main contrib non-free
deb https://deb.debian.org/debian/ stable-updates main contrib non-free
deb-src https://deb.debian.org/debian/ stable-updates main contrib non-free
使用 stable、testing、unstable 代號比具體版本號 (wheezy/jessie/stretch/buster/bullseye/bookworm) 更易維護。
Debian 12 Bookworm 非自由韌體獨立元件
Debian 12 起將非自由韌體分離為 non-free-firmware:
deb https://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
單次安裝不修改 sources.list
# 臨時啟用非自由倉庫安裝單一套件
sudo apt-get -o Dir::Etc::SourceList=/etc/apt/sources.list.nonfree update
sudo apt-get -o Dir::Etc::SourceList=/etc/apt/sources.list.nonfree install pkg-name
哲理提醒
Debian 社群堅持自由軟體原則,contrib 與 non-free 僅為用戶便利而維護,**不屬於 Debian 專案正式一部分**。「自由」不僅指價格,更指使用、研究、修改、分發的自由。選用閉源軟體前請評估授權限制與供應商鎖定風險。
copyright ©
萬盛學電腦網 all rights reserved