/etc/apt/sources.list
,列出 Debian 套件的典藏所 (或 “來源”)。APT 將匯入各來源節套件清單。下載 Packages.xz
或以不同的壓縮方法 (如 Packages.gz
或 .bz2
) 檔案 (使用執行套件時) 與 Sources.xz
或其他 (使用原始套件時) 然後分析其內容,就能完成該作用。已安裝舊版時,APT 可下載其差異更新之 (見專欄 秘訣 增量式升級)。
/etc/apt/sources.list
內的每列就是一個來源,包括三個以空格區隔的部份。
deb
” 表示為執行套件,
deb-src
” 表示來源套件。
Packages.xz
files, it must give a full and valid URL): this can consist in a Debian mirror or in any other package archive set up by a third party. The URL can start with file://
to indicate a local source installed in the system's file hierarchy, with http://
to indicate a source accessible from a web server, or with ftp://
for a source available on an FTP server. The URL can also start with cdrom:
for CD-ROM/DVD-ROM/Blu-ray disc based installations, although this is less frequent, since network-based installation methods are more and more common.
./
” 標示無次資料夾 — 套件就在指定的 URL 內) 的次資料夾 (含結尾的斜線)。比較常見的狀況是,像 Debian 鏡射站的典藏所,每個發行版有自己的元件。在這些情況下,選定發行版 (以 “代碼” 指名 — 見專欄 社群 布魯斯·佩倫斯,另類的領導者 — 或對應的 “組” — 穩定
、測試
、不穩定
),啟用 (選擇 Debian 鏡射的 main
、contrib
、與 non-free
) 組成元件 (或區)。
cdrom
條目表示您有此 CD/DVD-ROMs。相對於其他條目,CD-ROM 並非經常存在,一次祗能塞入一張。基於這個理由,以不同的方式管理此來源,需用到 apt-cdrom
程式,及 add
參數。要求將光碟插入光碟機,並找尋 套件
檔案。以此等檔案更新可用套件的資料庫 (通常以 apt update
命令完成它)。然後,APT 才能要求插入包括其套件的光碟。
sources.list
供系統執行 穩定 版 Debian:
範例 6.1. 供 Debian 穩定版使用者的 /etc/apt/sources.list
# Security updates deb http://security.debian.org/ stretch/updates main contrib non-free deb-src http://security.debian.org/ stretch/updates main contrib non-free ## Debian mirror # Base repository deb http://deb.debian.org/debian stretch main contrib non-free deb-src http://deb.debian.org/debian stretch main contrib non-free # Stable updates deb http://deb.debian.org/debian stretch-updates main contrib non-free deb-src http://deb.debian.org/debian stretch-updates main contrib non-free # Stable backports deb http://deb.debian.org/debian stretch-backports main contrib non-free deb-src http://deb.debian.org/debian stretch-backports main contrib non-free
stable
, stable-updates
, stable-backports
) because we don't want to have the underlying distribution changed outside of our control when the next stable release comes out.
sources.list
檔案前面的典藏庫。所以,非官方的來源多半放在此檔案的最後面。
security.debian.org
(在 Debian 系統管理者 維護的小機器內)。包括給 穩定版 使用的安全更新檔案 (由 Debian 安全團隊與套件管理者共同準備)。
建議更新
典藏庫的子集合。
建議的更新
典藏庫是儲放更新資料的地方 (由穩定版釋出經理管轄)。
stretch-proposed-updates
alias which is both more explicit and more consistent since jessie-proposed-updates
also exists (for the Oldstable updates):
deb http://ftp.debian.org/debian stretch-proposed-updates main contrib non-free
穩定回移
典藏庫儲存 “回移的套件”。係指重新編譯供舊發行版使用的套件,通常係供 h穩定版 使用。
穩定回移
的回移總是取材自 測試版 的套件。才能確保所有安裝的回移可順利地升級至下個 Debian 穩定版。
$
sudo apt-get install package/stretch-backports
$
sudo apt-get install -t stretch-backports package
sources.list
供執行 Debian 測試版 或 不穩定版 之用:
範例 6.2. /etc/apt/sources.list
檔案供 Debian 測試版/不穩定版 使用者
# Unstable deb http://deb.debian.org/debian unstable main contrib non-free deb-src http://deb.debian.org/debian unstable main contrib non-free # Testing deb http://deb.debian.org/debian testing main contrib non-free deb-src http://deb.debian.org/debian testing main contrib non-free # Stable deb http://deb.debian.org/debian stable main contrib non-free deb-src http://deb.debian.org/debian stable main contrib non-free # Security updates deb http://security.debian.org/ stable/updates main contrib non-free deb http://security.debian.org/ testing/updates main contrib non-free deb-src http://security.debian.org/ stable/updates main contrib non-free deb-src http://security.debian.org/ testing/updates main contrib non-free
sources.list
檔案安裝來自 不穩定版 的套件。若非必要,則使用 APT::Default-Release
設定 (見 節 6.2.3, “系統升級”) 指示 APT 從另個版本 (多半使用 測試版) 選取套件。
sources.list
內,並不表示該套件可順利使用,應加入這一個行:
deb http://deb.debian.org/debian experimental main contrib non-free
sources.list
examples in this chapter refer to package repositories hosted on deb.debian.og
. Those URLs will redirect you to servers which are close to you and which are managed by Content Delivery Networks (CDN) whose main role is to store multiple copies of the files across the world to deliver them as fast as possible to users. The CDN companies that Debian is working with are Debian partners who are offering their services freely to Debian. While none of those servers are under direct control of Debian, the fact that the whole archive is sealed by GPG signatures makes it a non-issue.
deb.debian.org
can try to find a better mirror in the official mirror list:
ftp.country-code.debian.org
(e.g. ftp.us.debian.org
for the USA, ftp.fr.debian.org
for France, etc.) which are covering many countries and which are pointing to one (or more) of the best mirrors available within that country.
deb.debian.org
, there used to be httpredir.debian.org
. This service would identify a mirror close to you (among the list of official mirrors, using GeoIP mainly) and would redirect APT's requests to that mirror. This service has been deprecated due to reliability concerns and now httpredir.debian.org
provides the same CDN-based service as deb.debian.org
.
mentors.debian.net
網站很有趣 (雖然它祗提供原始套件),因為它它的套件係供 Debian 官方發展者檢視或由志願者提供未經整合程序的套件。這些不保證品質的套件,允許並鼓勵使用者在正式使用之前,檢查並測試之。
sources.list
不變,但 APT 組態成像是快取。
/etc/approx/approx.conf
:
# <name> <repository-base-url> debian http://deb.debian.org/debian security http://security.debian.org
sources.list
file to point to the approx server:
# Sample sources.list pointing to a local approx server deb http://apt.falcot.com:9999/security stretch/updates main contrib non-free deb http://apt.falcot.com:9999/debian stretch main contrib non-free