Scroll to navigation

SOURCES.LIST(5) APT SOURCES.LIST(5)

名前

sources.list - APT のデータ取得元の設定リスト

説明

取得元リスト /etc/apt/sources.list と /etc/apt/sources.list.d/ に含まれるファイルは、複数の取得元や様々なメディアをサポートするよう設計されています。ファイルは、1 行に一つの取得元をリストする (1 行スタイル) かまたはスタンザごとに複数の取得元を定義し、(シングルバージョンが複数の取得元から入手可能である場合には) 最も好ましい取得元を先頭に置く複数行のスタンザ (deb822 スタイル) を含みます。設定した取得元から利用可能な情報は、apt-get update (や、ほかの APT フロントエンドの同等のコマンド) で取得します。

SOURCES.LIST.D

/etc/apt/sources.list.d ディレクトリは、別々のファイルで source.list のエントリを追加する方法を提供します。次の二つの節で説明するように、二つの異なるファイル形式が許可されています。ファイル名は、含まれている形式に応じて .list または .sources のいずれかの拡張子を持っている必要があります。ファイル名は、文字 (a-z と A-Z)、数字 (0-9)、アンダースコア (_)、ハイフン (-)、ピリオド (.) のみを含むことができます。そうでなければ、Dir::Ignore-Files-Silently 設定リストのパターンに一致するもの以外に対して、ファイルを無視するという注意を APT が出力します。一致する場合は黙って無視します。

1 行スタイル形式

この形式のファイルは、.list 拡張子を持っています。取得元を指定する各行は、この型のオプションと引数が続く型 deb-src から始まります。個々のエントリは、次の行に継続することはできません。空行は無視され、行の任意の位置の # 文字はコメントとして行の残りの部分をマークします。したがって行全体をコメントアウトすることによって、エントリを無効にすることができます。オプションが提供されている場合、スペースで区切られ、すべて角カッコ ([]) で囲まれていて、行の中でスペースで区切られた型の後ろに含まれます。複数の値が許されるオプションの場合、カンマ (,) で分離されています。オプション名は、イコール記号 (=) で分離されます。複数値のオプションも -= および += をセパレータとして持ち、デフォルト値から与えられた値を削除するか、またはデフォルト値に与えられた値を含めます。

伝統的な形式とすべての apt のバージョンでサポートされています。下記のようにすべてのオプションがすべての apt のバージョンでサポートされているわけでないことに注意してください。いくつかの古いアプリケーションは、自分でこの形式をパースするので、マルチアーキテクチャのサポートの導入前には珍しいオプションに遭遇することを期待しないかもしれないことに注意してください。

DEB822 スタイル形式

Files in this format have the extension .sources. The format is similar in syntax to other files used by Debian and its derivatives, such as the metadata files that apt will download from the configured sources or the debian/control file in a Debian source package. Individual entries are separated by an empty line; additional empty lines are ignored, and a # character at the start of the line marks the entire line as a comment. An entry can hence be disabled by commenting out each line belonging to the stanza, but it is usually easier to add the field "Enabled: no" to the stanza to disable the entry. Removing the field or setting it to yes re-enables it. Options have the same syntax as every other field: A fieldname separated by a colon (:) and optionally spaces from its value(s). Note especially that multiple values are separated by whitespaces (like spaces, tabs and newlines), not by commas as in the one-line format. Multivalue fields like Architectures also have Architectures-Add and Architectures-Remove to modify the default value rather than replacing it.

バージョン 1.1 以降の apt 自身によりサポートされる新しい形式です。前述のように以前のバージョンでは、通知メッセージでそのようなファイルを無視します。多くのソースおよび/またはオプションが関与している場合は特に、人間と機械を問わず、作成、拡張、変更を簡単にするために、先に述べた 1 行スタイル形式を非推奨にし、徐々にこの形式をデフォルト形式にすることが意図されています。apt ソースを作業および/またはパースしている開発者は、このフォーマットのサポートを追加することと、調整するために APT チームに連絡すること、この作業を共有することをお勧めします。ユーザはすでに自由にこの形式を採用することができますが、この形式をまだサポートしていないソフトウェアで問題が発生する場合があります。

DEB および DEB-SRC タイプ: 一般形式

deb タイプでは典型的な 2 段階の Debian アーカイブ distribution/component を参照します。distribution は通常 stable や testing または buster や bullseye のようなコード名になります。component は、main, contrib, non-free のどれかです。deb-src タイプでは、debian ディストリビューションのソースコードを、deb タイプと同じ形式で参照します。deb-src 行は、ソースインデックスを取得するのに必要です。

deb および deb-src タイプで使用する 2 つの 1 行スタイルのエントリの形式は、以下のようになります:

deb [ option1=value1 option2=value2 ] uri suite [component1] [component2] [...]
deb-src [ option1=value1 option2=value2 ] uri suite [component1] [component2] [...]

他に deb822 スタイルで同等のエントリもサポートしています:

     Types: deb deb-src
     URIs: uri
     Suites: suite
     Components: [component1] [component2] [...]
     option1: value1
     option2: value2
   

deb タイプの URI は、APT が必要な情報を見つけられるように、Debian ディストリビューションの基底を指定しなければなりません。スイートには正確なパスを指定できます。その場合コンポーネントを省略し、スイートはスラッシュ (/) で終わらなくてはなりません。これは URL で指定されたアーカイブの、特定のサブディレクトリのみに関心があるときに役に立ちます。スイートに正確なパスを指定しないのなら、少なくとも一つは コンポーネント を指定しなければなりません。

スイート は、$(ARCH) 変数を含む場合があります。$(ARCH) 変数は、システムで使用している Debian アーキテクチャ (amd64 や armel など) に展開されます。これにより、アーキテクチャに依存しない sources.list ファイルを使用できます。一般的に、これは正しいパスを指定するときに気にするだけです。そうでない場合は、APT は現在のアーキテクチャで URI を自動的に生成します。

特に 1 行スタイル形式では 1 行につき 1 つのディストリビューションしか指定できないため、同じ URI の行を複数記述することになるでしょう。APT は内部で URI リストを生成してから、並べ替えます。そして、同じインターネットホストに対しては複数の参照をまとめます。例えば FTP 接続後、切断してからまた同じホストに再接続するといった効率の悪いことをせずに、1 接続にまとめます。APT は、帯域の狭いサイトを効率よく扱うため異なるホストへは接続を並行して行うようにもしています。

最優先する取得元を最初に記述するというように、優先順に取得元を記述するのは重要です。一般的には、スピードの速い順に並べることになる (例えば、CD-ROM に続いてローカルネットワークのホスト、さらに続いて彼方のインターネットホスト) でしょう。

例として、あなたのディストリビューション用のソースは、1 行スタイル形式で次のようになります:

deb http://deb.debian.org/debian buster main contrib non-free
deb http://security.debian.org buster/updates main contrib non-free

または deb822 スタイル形式でこのようになります:

Types: deb
URIs: http://deb.debian.org/debian
Suites: buster
Components: main contrib non-free
Types: deb
URIs: http://security.debian.org
Suites: buster/updates
Components: main contrib non-free

DEB および DEB-SRC タイプ: オプション

各取得元エントリは、アクセスされる取得元や取得されるデータを変更するために指定するオプションを持つことができます。オプションの形式、構文と名前は、記載されているように 1 行スタイルと deb822 スタイルの間で異なりますが、どちらも同じオプションが用意されています。簡単にするために、deb822 フィールド名を一覧表示し、カッコ内に 1 行の名前を提供します。明示的に複数の値を持つオプションを設定する以外に、デフォルトをベースに変更するためのオプションもあることを忘れないでください。ここでは明示的にそれらの名前はリストしていません。サポートされていないオプションは、すべての APT バージョンで黙って無視されます。

Architectures (arch) は複数の値を持つオプションで、どのアーキテクチャ情報をダウンロードするか指定します。このオプションを指定しないと、APT::Architectures 設定オプションに定義してあるすべてのアーキテクチャをダウンロードします。

•arch=arch1,arch2,... により、どのアーキテクチャ情報をダウンロードするか指定します。このオプションを指定しないと、APT::Architectures オプションに定義してある全アーキテクチャをダウンロードします。

Targets (target) は値を複数取るオプションで、apt がその取得元から取得するダウンロード対象を定義します。指定しない場合のデフォルトセットは設定項目 Acquire::IndexTargets で定義されます (対象は Created-By の名前により指定されます)。また、複数の値を取るこのオプションに代えて、真偽値を指定した Identifier をオプションとして使うことで有効化、無効化できます。

PDiffs (pdiffs) は、新しいインデックスを完全にダウンロードする代わりに、古いインデックスを更新するため PDiffs を使用するかどうかを制御する yes/no 値です。レポジトリが PDiffs の提供を公開していない場合は、このオプションの値は無視されます。Acquire::IndexTargets スコープ中に定義された特定のインデックスファイル用の同じ名前のオプション値がデフォルトになり、設定オプション Acquire::PDiffs のデフォルト値は yes です。

By-Hash (by-hash) は、yes、no または force の値を持つことができます。そして、APT がインデックスのよく知られた安定版の名前を使用する代わりに、期待されるファイルのハッシュ値から構築された URI を経由してインデックスを取得するかどうかを制御します。これを使用すると、ハッシュ値の不一致を避けることができますが、ミラーのサポートを必要とします。この取得元がそのサポートを示す場合、yes または no の値は、この機能の使用を有効化/無効化します。force は取得元が示すものに関係なく、機能を有効にします。Acquire::IndexTargets スコープ中に定義された特定のインデックスファイル用の同じ名前のオプション値がデフォルトになり、設定オプション Acquire::By-Hash のデフォルト値は yes です。

さらに、設定が同じ URI とスイートのすべての取得元に影響する場合のオプションがあり、このようなすべてのエントリに設定する必要があり、異なる要素間で変化することができません。APT はこのような異常を検出してエラー出力しようとします。

Allow-Insecure (allow-insecure), Allow-Weak (allow-weak), Allow-Downgrade-To-Insecure (allow-downgrade-to-insecure) は真偽値でデフォルトはどれも no となっています。yes をセットすると apt-secure(8) の部分を迂回するため安易に有効化すべきではありません!

Trusted (trusted) は、APT の判断のデフォルトのトライステート値で、取得元が信頼できる、以前警告が発生した (例えば、パッケージをこの取得元からインストールしたときに)、信頼できないの 3 値です。このオプションは、APT の決定を上書きするために使用することができます。値 yes は、それが認証チェックに合格しない場合であっても、この取得元が信頼できると考えられることを常に APT に伝えます。apt-secure(8) の一部を無効にするので、(すべてであれば) ローカルおよび信頼されたコンテキストでのみ使用するべきです。そうしなければ、セキュリティが破られます。値 no は反対のことを行います。認証チェックに合格した場合でも取得元を信頼できないとして扱います。デフォルト値は明示的に設定することはできません。

Signed-By (signed-by) is an option to require a repository to pass apt-secure(8) verification with a certain set of keys rather than all trusted keys apt has configured. It is specified as a list of absolute paths to keyring files (have to be accessible and readable for the _apt system user, so ensure everyone has read-permissions on the file) and fingerprints of keys to select from these keyrings. If no keyring files are specified the default is the trusted.gpg keyring and all keyrings in the trusted.gpg.d/ directory (see apt-key fingerprint). If no fingerprint is specified all keys in the keyrings are selected. A fingerprint will accept also all signatures by a subkey of this key, if this isn't desired an exclamation mark (!) can be appended to the fingerprint to disable this behaviour. The option defaults to the value of the option with the same name if set in the previously acquired Release file of this repository (only fingerprints can be specified there through). Otherwise all keys in the trusted keyrings are considered valid signers for this repository.

Check-Valid-Until (check-valid-until) は、APT がリプレイ攻撃を検出するかどうかを制御する yes/no 値です。リポジトリの作成者は、リポジトリに提供されたデータが有効とみなされる時間を宣言することができます。そして、この時間に達しているが、新しいデータが提供されていない場合、データが期限切れになったとみなされ、エラーが発生します。セキュリティを高めることに加えて、新しいバージョンにアップグレードするユーザを守るために、悪意のある攻撃者が古いデータを永遠に送れないようにすることで、長期間更新されていないミラーをユーザが特定するのに役立ちます。しかしながら、歴史的アーカイブなど、いくつかのリポジトリは、設計によりこれ以上更新されないので、このオプションを no に設定することで、このチェックを無効にすることができます。設定オプション Acquire::Check-Valid-Until の値がデフォルトになり、そのデフォルトは yes です。

Valid-Until-Min (valid-until-min) および Valid-Until-Max (valid-until-max) は、このリポジトリからのデータの有効期間 (秒単位) を上げたり下げたりするために使用することができます。リポジトリが独自の値を設定するリリースファイルに Valid-Until フィールドがないものを提供する場合、-Max は特に有用です。-Min は完全にチェックを無効にする代わりに (sources.list 同様にある) より頻繁に更新があるミラーの、あまりアクセスされないアーカイブの有効期間を増やすことができます。設定オプション Acquire::Min-ValidTime および Acquire::Max-ValidTime の値がデフォルトになり、その両方のデフォルト値は unset です。

Check-Date (check-date) is a yes/no value which controls if APT should consider the machine's time correct and hence perform time related checks, such as verifying that a Release file is not from the future. Disabling it also disables the Check-Valid-Until option mentioned above.

Date-Max-Future (date-max-future) controls how far from the future a repository may be. Default to the value of the configuration option Acquire::Max-FutureTime which is 10 seconds by default.

InRelease-Path (inrelease-path) determines the path to the InRelease file, relative to the normal position of an InRelease file. By default, this option is unset and APT will try to fetch an InRelease or, if that fails, a Release file and its associated Release.gpg file. By setting this option, the specified path will be tried instead of the InRelease file, and the fallback to Release files will be disabled.

URI の仕様

現在認識できる URI タイプは以下のとおりです:

http (apt-transport-http(1))

The http scheme specifies an HTTP server for an archive and is the most commonly used method. The URI can directly include login information if the archive requires it, but the use of apt_auth.conf(5) should be preferred. The method also supports SOCKS5 and HTTP(S) proxies either configured via apt-specific configuration or specified by the environment variable http_proxy in the format (assuming an HTTP proxy requiring authentication) http://user:pass@server:port/. The authentication details for proxies can also be supplied via apt_auth.conf(5).

Note that these forms of authentication are insecure as the whole communication with the remote server (or proxy) is not encrypted so a sufficiently capable attacker can observe and record login as well as all other interactions. The attacker can not modify the communication through as APTs data security model is independent of the chosen transport method. See apt-secure(8) for details.

https (apt-transport-https(1))

The https scheme specifies an HTTPS server for an archive and is very similar in use and available options to the http scheme. The main difference is that the communication between apt and server (or proxy) is encrypted. Note that the encryption does not prevent an attacker from knowing which server (or proxy) apt is communicating with and deeper analysis can potentially still reveal which data was downloaded. If this is a concern the Tor-based schemes mentioned further below might be a suitable alternative.

mirror, mirror+scheme (apt-transport-mirror(1))

The mirror scheme specifies the location of a mirrorlist. By default the scheme used for the location is http, but any other scheme can be used via mirror+scheme. The mirrorlist itself can contain many different URIs for mirrors the APT client can transparently pick, choose and fallback between intended to help both with distributing the load over the available mirrors and ensuring that clients can acquire data even if some configured mirrors are not available.

file

file スキームは、システム内の任意のディレクトリを、アーカイブとして扱えるようにします。これは NFS マウントやローカルミラーで便利です。

cdrom

The cdrom scheme allows APT to use a local CD-ROM, DVD or USB drive with media swapping. Use the apt-cdrom(8) program to create cdrom entries in the source list.

ftp

The ftp scheme specifies an FTP server for an archive. Use of FTP is on the decline in favour of http and https and many archives either never offered or are retiring FTP access. If you still need this method many configuration options for it are available in the Acquire::ftp scope and detailed in apt.conf(5).

Please note that an FTP proxy can be specified by using the ftp_proxy environment variable. It is possible to specify an HTTP proxy (HTTP proxy servers often understand FTP URLs) using this environment variable and only this environment variable. Proxies using HTTP specified in the configuration file will be ignored.

copy

copy スキームは、file スキームと同様ですが、パッケージをその場で使用せず、キャッシュディレクトリにコピーするところが違います。リムーバブルメディアを使用していて、APT でコピーを行う場合に便利です。

rsh, ssh

rsh/ssh メソッドは、与えられたユーザでリモートホストに接続し、ファイルにアクセスするのに rsh/ssh を使用します。あらかじめ rhosts や RSA キーの設定をしておくことをお勧めします。リモートホストからのファイル転送に、標準の find コマンドと dd コマンドを使用します。

さらに認識できる URI タイプの追加

APT can be extended with more methods shipped in other optional packages, which should follow the naming scheme apt-transport-method. For instance, the APT team also maintains the package apt-transport-tor, which provides access methods for HTTP and HTTPS URIs routed via the Tor network.

サンプル

/home/apt/debian に格納されている stable/main, stable/contrib, stable/non-free 用のローカル (または NFS) アーカイブを使用します。

deb file:/home/apt/debian stable main contrib non-free

Types: deb
URIs: file:/home/apt/debian
Suites: stable
Components: main contrib non-free

上記と同様ですが、不安定版 (開発版) を使用します。

deb file:/home/apt/debian unstable main contrib non-free

Types: deb
URIs: file:/home/apt/debian
Suites: unstable
Components: main contrib non-free

上記のソースの指定は以下のようになります。

deb-src file:/home/apt/debian unstable main contrib non-free

Types: deb-src
URIs: file:/home/apt/debian
Suites: unstable
Components: main contrib non-free

1 行目は APT::Architectures にあるアーキテクチャのパッケージ情報を取得し、2 行目は常に amd64 アーキテクチャと armel アーキテクチャのパッケージ情報を取得します。

deb http://deb.debian.org/debian buster main
deb [ arch=amd64,armel ] http://deb.debian.org/debian buster main

Types: deb
URIs: http://deb.debian.org/debian
Suites: buster
Components: main
Types: deb
URIs: http://deb.debian.org/debian
Suites: buster
Components: main
Architectures: amd64 armel

archive.debian.org のアーカイブに HTTP アクセスし、hamm/main のみを使用します。

Types: deb
URIs: http://archive.debian.org/debian-archive
Suites: hamm
Components: main

ftp.debian.org のアーカイブに FTP アクセスし、debian ディレクトリ以下の buster/contrib のみを使用します。

deb ftp://ftp.debian.org/debian buster contrib

Types: deb
URIs: ftp://ftp.debian.org/debian
Suites: buster
Components: contrib

ftp.debian.org のアーカイブに FTP アクセスし、debian ディレクトリ以下の unstable/contrib のみを使用します。sources.list に上記サンプルと一緒に指定された場合、両方のリソース行に対応する FTP セッションはひとつだけになります。

deb ftp://ftp.debian.org/debian unstable contrib

Types: deb
URIs: ftp://ftp.debian.org/debian
Suites: unstable
Components: contrib

ftp.tlh.debian.org のアーカイブに HTTP アクセスし、universe ディレクトリ以下を使用します。また、i386 マシンでは unstable/binary-i386 以下にあるファイル、amd64 マシンでは unstable/binary-amd64 以下にあるファイル、その他サポートするアーキテクチャごとのファイルのみ使用します。[このサンプルは変数展開の使用法の説明でしかないことに注意してください。公式 debian アーカイブはこのような構造になっていません]

deb http://ftp.tlh.debian.org/universe unstable/binary-$(ARCH)/

Types: deb
URIs: http://ftp.tlh.debian.org/universe
Suites: unstable/binary-$(ARCH)/

安定版、テスト版、不安定版スイートからバイナリパッケージやソース、およびmain と contrib コンポーネントを入手するため HTTP を使用しています。

deb http://deb.debian.org/debian stable main contrib
deb-src http://deb.debian.org/debian stable main contrib
deb http://deb.debian.org/debian testing main contrib
deb-src http://deb.debian.org/debian testing main contrib
deb http://deb.debian.org/debian unstable main contrib
deb-src http://deb.debian.org/debian unstable main contrib

Types: deb deb-src
URIs: http://deb.debian.org/debian
Suites: stable testing unstable
Components: main contrib

関連項目

apt-get(8), apt.conf(5), /usr/share/doc/apt-doc/acquire-additional-files.md.gz

バグ

APT バグページ[1] をご覧ください。 APT のバグを報告する場合は、 /usr/share/doc/debian/bug-reporting.txt や reportbug(1) コマンドをご覧ください。

翻訳

倉澤 望 <nabetaro@debian.or.jp> (2003-2006,2009-2012), Takuma Yamada <tyamada@takumayamada.com> (2016), Debian JP Documentation ML <debian-doc@debian.or.jp>

この翻訳文書には未訳部分が含まれている可能性があることに 注意してください。 翻訳がオリジナルに追従できていない場合、 内容を失わないようにこのようにしています。

著者

Gunthorpe Jason[FAMILY Given]

[FAMILY Given]

注記

1.
APT バグページ
17 8 月 2018 APT 1.8.2.1