Provided by:
apt_0.7.25.3ubuntu7_i386 
NAME
apt_preferences - APT 設定制御ファイル
明
The APT preferences file /etc/apt/preferences and the fragment files in
the /etc/apt/preferences.d/ folder can be used to control which
versions of packages will be selected for installation.
sources.list(5) ファイルに複数のディストリビューション (stable と
testing など)
が指定されていて、パッケージに対し複数のバージョンがインストールで-
ることがあります。このと APT は、利用で-
るバージョンごとに優先度を割り当てます。依存関係規則を条件として、apt-get
は、最も高い優先度を持つバージョンをインストールするよう選択します。APT
設定ファイルは、APT
がデフォルトで割り当てた、パッケージのバージョンの優先度を上書-
します。その結果インストールするものの選択を、ユーザが選択で-
るようになります。
sources.list(5)
ファイルに複数の参照が書かれている場合、パッケージの同じバージョンのインスタンスが複数利用で-
る可能世あります。この場合、apt-get は sources.list(5)
ファイルの初めの方に指定されているところからダウンロードします。APT
設定ファイルはバージョンの選択にのみ影響し、インスタンスの選択には影響しません。
Note that the files in the /etc/apt/preferences.d directory are parsed
in alphanumeric ascending order and need to obey the following naming
convention: The files have no or "pref" as filename extension and which
only contain alphanumeric, hyphen (-), underscore (_) and period (.)
characters - otherwise they will be silently ignored.
APTて
設定ファイルがなかったり、設定ファイルに特定のパッケージを割り当てるエントリがない場合、そのバージョンの優先度は、そのバージョンが属しているディストリビューションの優先度となります。デフォルトで他のディストリビューションより高い優先度を持つ、特定のディストリビューションを「ターゲットリリース」としておけます。後述する
/etc/apt/preferences
ファイルで設定した一般優先度よりもこれは優先されますが、pin
止めしたパッケージには及ばないことに注意してください。例えば以下のようになります。
apt-get install -t testing some-package
APT::Default-Release "stable";
ターゲットリリースが指定されると、APT
は以下のアルゴリズムで、パッケージのバージョンの優先度を設定します。以下のように割り当てます。.PP
priority 100
(あるならば) 既にインストールされているバージョン。
priority 500
インストールされておらず、ターゲットリリースに含まれないバージョン。
priority 990
インストールされておらず、ターゲットリリースに含まれるバージョン。
ターゲットリリースが指定されていなければ、APT
は単純にインストールしているパッケージのバージョンには 100
を、インストールしていないパッケージのバージョンには 500
を割り当てます。
APT
は、インストールするパッケージのバージョンを決定するために、以下のルールを上から順番に適用します。
o 邑なバージョンの優先度が 1000
を越えない場合、決してダウングレードしません。(「ダウングレード」は、現在のパッケージのバージョンよりも、小さいバージョンのものをインストールします。APT
のデフォルト優先度が 1000
を越えないことに注意してください。そのような優先度は設定ファイルでのみ設定で-
ます。また、パッケージのダウングレードは危険であることにも注意してください)
o 最も高い優先度のバージョンをインストールします。
o 同じ優先度のバージョンが複数存在する場合、最も新しいもの
(最もバージョン番号が高いもの) をインストールします。
o 優先度・バージョン番号が同じものが複数存在し、そのパッケージのメタデータが異なるか
--reinstall
オプションが与えられている場合、インストールされていないものをインストールします。
よくある状況として、あるインストールされているパッケージのバージョン
(優先度 100) が、sources.list(5) ファイルのリストから得られるバージョン
(優先度 500 か 990)
よりも新しくないということがあります。この場合、apt-get install
some-package や apt-get upgrade を実行するとパッケージが更新されます。
まれに、インストールされているパッケージのバージョンが、__apt-get install
some-package や apt-get upgrade を実行しても、ダウングレードしません。
時々、インストールしているパッケージのバージョンが、ターゲットリリースに属するバージョンよりも新しく、他のディストリビューションよりも古い場合があります。そのようなパッケージに対して
apt-get install some-package や apt-get upgrade
を実行すると、パッケージは更新されます。この場合、インストールされているバージョンよりも、少なくとも_APT果
APT
設定ファイルを使うと、システム管理者が優先度を割り当てられるようになります。ファイルは、空白行で区切られた、複数行からなるレコードで構成されています。レコードは特定形式か、汎用形式のどちらかの形式をとります。
o 特定形式は、優先度 ("Pin-Priority")
を、指定したパッケージの指定したバージョン (範囲)
について割り当てます。例えば以下のレコードは、"5.8" で始まる perl
パッケージを、高い優先度に設定します。
Package: perl
Pin: version 5.8*
Pin-Priority: 1001
o 汎用形式は、与えられたディストリビューションにある、すべてのパッケージ
(Release ファイルに列挙したパッケージ)
の優先度や、FQDNで指定した、特定のインターネットサイトから取得するパッケージの優先度を割り当てます。
APT
設定ファイルに書かれている汎用形式のエントリは、パッケージのグループについてのみ適用されます。例えば以下のレコードは、ローカルサイトにある全パッケージについて、高い優先度を割り当てます。
Package: *
Pin: origin ""
Pin-Priority: 999
注意: ここで使用しているァ璽錙璽匹 "origin" です。Release
ファイルに指定されたような、ディストリビューションの Origin
と混同しないようにしてください。Release ファイルにある "Origin:"
タグは、インターネットアドレスではなく、"Debian" や "Ximian"
といった作者やベンダ名です。
以下のレコードは、アーカイブ名が "unstable"
となっているディストリビューションに属するパッケージを、すべて低い優先度に割り当てます。
Package: *
Pin: release a=unstable
Pin-Priority: 50
以下のレコードは、コード名が "squeeze"
となっているディストリビューションに属するパッケージを、すべて高い優先度に割り当てます。
Package: *
Pin: release n=squeeze
Pin-Priority: 900
以下のレコードは、アーカイブ名が "stable"
で、リリースバージョン番号が "3.0"
となっているリリースに属するパッケージを、すべて高い優先度に割り当てます。
Package: *
Pin: release a=stable, v=3.0
Pin-Priority: 500
APT法
APT 設定ファイルで割り当てた優先度 (P)
は、正負の整数でなくてはなりません。これは (おおざっぱにいうと)
以下のように解釈されます。.PP P > 1000
パッケージがダウングレードしても、このバージョンのパッケージをインストール
990 < P <=1000
インストールされているバージョンの方が新しいことを除-
、ターゲットリリースに含まれなくても、このバージョンのパッケージをインストール
500 < P <=990
ターゲットリリースに属するバージョンがあったり、インストールされているバージョンの方が新しいのでなければ、このバージョンのパッケージをインストール
100 < P <=500
他のディストリビューションに属するバージョンがあったり、インストールされているバージョンの方が新しいのでなければ、このバージョンのパッケージをインストール
0 < P <=100
このパッケージがインストールされていない場合、このバージョンのパッケージをインストール
P < 0
このバージョンのインストール禁止
特定形式のレコードが利用可能パッケージバージョンに一致した場合、最初のレコードが、パッケージバージョンの優先度を決定します。失敗して、汎用形式のレコードが利用可能パッケージバージョンに一致した場合、最初のレコードが、パッケージバージョンの優先度を決定します。
例えば、APT
設定ファイルの上の方に、以下のレコードが書かれていると仮定してください。
Package: perl
Pin: version 5.8*
Pin-Priority: 1001
Package: *
Pin: origin ""
Pin-Priority: 999
Package: *
Pin: release unstable
Pin-Priority: 50
すると、以下のように動作します。
o バージョン番号が "5.8" で始まっていれば、perl
の最新の利用可能パッケージがインストールされます。バージョン 5.8*
が利用可能で、バージョン 5.9* がインストールされている場合、perl
はダウングレードされます。
o ローカルシステムで邑な、perl
以外のどんなパッケージでも、他のバージョンより
(たとえターゲットリリースに属していても) 優先度が高くなります。
o ローカルシステムにはなくても sources.list(5)
に列挙されたサイトにあるバージョンで、unstable
ディストリビューションに属しているパッケージは、インストールするよう選択され、既にインストールされているバージョンがない場合にのみインストールされます。
定
sources.list(5) ファイルに列挙した場所では、その場所で利用で-
るパッケージを欺劼靴拭Packages ファイルや Release
ファイルを提供します。
Packages ファイルは通常 .../dists/dist-name/component/arch
ディレクトリにあります。例えば、.../dists/stable/main/binary-i386/Packages
です。これは、ディレクトリにある利用可能パッケージごとに、複数行のレコードからで-
ています。APT 優先度の設定は、レコードごとに以下の 2 行だけです。.PP
Package: 行
パッケージ名
Version: 行
その名前のパッケージのバージョン番号
The Release file is normally found in the directory
.../dists/dist-name: for example, .../dists/stable/Release, or
.../dists/woody/Release. It consists of a single multi-line record
which applies to all of the packages in the directory tree below its
parent. Unlike the Packages file, nearly all of the lines in a Release
file are relevant for setting APT priorities:
Archive: 行や Suite: 行
names the archive to which all the packages in the directory tree
belong. For example, the line "Archive: stable" or "Suite: stable"
specifies that all of the packages in the directory tree below the
parent of the Release file are in a stable archive. Specifying this
value in the APT preferences file would require the line:
Pin: release a=stable
Codename: 行
names the codename to which all the packages in the directory tree
belong. For example, the line "Codename: squeeze" specifies that
all of the packages in the directory tree below the parent of the
Release file belong to a version named squeeze. Specifying this
value in the APT preferences file would require the line:
Pin: release n=squeeze
Version: 行
リリースバージョン名です。例えば、このツリーのパッケージが、GNU/Linux
リリースバージョン 3.0 に属するとします。通常 testing
ディストリビューションや unstable
ディストリビューションには、まだリリースされていないので、バージョン番号が付-
ません。APT
設定ファイルでこれを指定するには、以下の行のいずれかが必要になります。
Pin: release v=3.0
Pin: release a=stable, v=3.0
Pin: release 3.0
Component: 行
Release
ファイルの、ディレクトリツリーにあるパッケージのライセンスコンポーネント名です。例えば、"Component:
main" という行は、このディレクトリ以下の全ファイルが、main
コンポーネント (Debian
フリーソフトウェアガイドラインの元でライセンスされている)
であることを表します。APT
設定ファイルでこのコンポーネントを指定するには、以下の行が必要になります。
Pin: release c=main
Origin: 行
Release
ファイルのディレクトリツリーにあるパッケージの提供者名です。ほとんど共通で、Debian
です。APT
設定ファイルでこの提供者を指定するには、以下の行が必要になります。
Pin: release o=Debian
Label: 行
Release
ファイルのディレクトリツリーにあるパッケージのラベル名です。ほとんど共通で
Debian です。APT
設定ファイルでこのラベルを指定するには、以下の行が必要になります。
Pin: release l=Debian
sources.list(5) ファイルに列挙された場所から取得した Packages
ファイルや Release ファイルはすべて、/var/lib/apt/lists
ディレクトリや、apt.conf ファイルの Dir::State::Lists
変数で指定した場所に取得されます。例えば、debian.lcs.mit.edu_debian_dists_unstable_contrib_binary-i386_Release
ファイルは、debian.lcs.mit.edu から取得した、unstable
ディストリビューションで、contrib コンポーネントな、binary-i386 アー-
テクチャ用の Release ファイルを含んでいます。
APT行
APT 設定ファイルのレコードごとに、任意で Explanation:
で始まる行を持てます。これは、コメント用の場所を確保します。
The Pin-Priority: line in each APT preferences record is optional. If
omitted, APT assigns a priority of 1 less than the last value specified
on a line beginning with Pin-Priority: release ....
ル
跡
The following APT preferences file will cause APT to assign a priority
higher than the default (500) to all package versions belonging to a
stable distribution and a prohibitively low priority to package
versions belonging to other Debian distributions.
Explanation: Uninstall or do not install any Debian-originated
Explanation: package versions other than those in the stable distro
Package: *
Pin: release a=stable
Pin-Priority: 900
Package: *
Pin: release o=Debian
Pin-Priority: -10
With a suitable sources.list(5) file and the above preferences file,
any of the following commands will cause APT to upgrade to the latest
stable version(s).
apt-get install package-name
apt-get upgrade
apt-get dist-upgrade
The following command will cause APT to upgrade the specified package
to the latest version from the testing distribution; the package will
not be upgraded again unless this command is given again.
apt-get install package/testing
跡
The following APT preferences file will cause APT to assign a high
priority to package versions from the testing distribution, a lower
priority to package versions from the unstable distribution, and a
prohibitively low priority to package versions from other Debian
distributions.
Package: *
Pin: release a=testing
Pin-Priority: 900
Package: *
Pin: release a=unstable
Pin-Priority: 800
Package: *
Pin: release o=Debian
Pin-Priority: -10
With a suitable sources.list(5) file and the above preferences file,
any of the following commands will cause APT to upgrade to the latest
testing version(s).
apt-get install package-name
apt-get upgrade
apt-get dist-upgrade
The following command will cause APT to upgrade the specified package
to the latest version from the unstable distribution. Thereafter,
apt-get upgrade will upgrade the package to the most recent testing
version if that is more recent than the installed version, otherwise,
to the most recent unstable version if that is more recent than the
installed version.
apt-get install package/unstable
Tracking the evolution of a codename release
The following APT preferences file will cause APT to assign a priority
higher than the default (500) to all package versions belonging to a
specified codename of a distribution and a prohibitively low priority
to package versions belonging to other Debian distributions, codenames
and archives. Note that with this APT preference APT will follow the
migration of a release from the archive testing to stable and later
oldstable. If you want to follow for example the progress in testing
notwithstanding the codename changes you should use the example
configurations above.
Explanation: Uninstall or do not install any Debian-originated package versions
Explanation: other than those in the distribution codenamed with squeeze or sid
Package: *
Pin: release n=squeeze
Pin-Priority: 900
Explanation: Debian unstable is always codenamed with sid
Package: *
Pin: release a=sid
Pin-Priority: 800
Package: *
Pin: release o=Debian
Pin-Priority: -10
With a suitable sources.list(5) file and the above preferences file,
any of the following commands will cause APT to upgrade to the latest
version(s) in the release codenamed with squeeze.
apt-get install package-name
apt-get upgrade
apt-get dist-upgrade
The following command will cause APT to upgrade the specified package
to the latest version from the sid distribution. Thereafter, apt-get
upgrade will upgrade the package to the most recent squeeze version if
that is more recent than the installed version, otherwise, to the most
recent sid version if that is more recent than the installed version.
apt-get install package/sid
ル
/etc/apt/preferences
Version preferences file. This is where you would specify
"pinning", i.e. a preference to get certain packages from a
separate source or from a different version of a distribution.
Configuration Item: Dir::Etc::Preferences.
/etc/apt/preferences.d/
File fragments for the version preferences. Configuration Item:
Dir::Etc::PreferencesParts.
目
apt-get(8) apt-cache(8) apt.conf(5) sources.list(5)
グ
APT[1] をご覧ください。 APT のバグを報告する場合は、
/usr/share/doc/debian/bug-reporting.txt や reportbug(1)
コマンドをご覧ください。
者
倉澤 望 nabetaro@debian.or.jp (2003-2006,2009), Debian JP Documentation
ML debian-doc@debian.or.jp
Note that this translated document may contain untranslated parts. This
is done on purpose, to avoid losing content when the translation is
lagging behind the original content.
AUTHOR
APT team
NOTES
1. APT バグページ
http://bugs.debian.org/src:apt