apt_preferences.5.xml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. <?xml version="1.0" encoding="utf-8" standalone="no"?>
  2. <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % aptent SYSTEM "apt.ent"> %aptent;
  5. <!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent"> %aptverbatiment;
  6. <!ENTITY % aptvendor SYSTEM "apt-vendor.ent"> %aptvendor;
  7. ]>
  8. <refentry>
  9. <refentryinfo>
  10. &apt-author.team;
  11. &apt-email;
  12. &apt-product;
  13. <!-- The last update date -->
  14. <date>2012-06-09T00:00:00Z</date>
  15. </refentryinfo>
  16. <refmeta>
  17. <refentrytitle>apt_preferences</refentrytitle>
  18. <manvolnum>5</manvolnum>
  19. <refmiscinfo class="manual">APT</refmiscinfo>
  20. </refmeta>
  21. <!-- Man page title -->
  22. <refnamediv>
  23. <refname>apt_preferences</refname>
  24. <refpurpose>Preference control file for APT</refpurpose>
  25. </refnamediv>
  26. <refsect1>
  27. <title>Description</title>
  28. <para>The APT preferences file <filename>/etc/apt/preferences</filename>
  29. and the fragment files in the <filename>/etc/apt/preferences.d/</filename>
  30. folder can be used to control which versions of packages will be selected
  31. for installation.</para>
  32. <para>Several versions of a package may be available for installation when
  33. the &sources-list; file contains references to more than one distribution
  34. (for example, <literal>stable</literal> and <literal>testing</literal>).
  35. APT assigns a priority to each version that is available.
  36. Subject to dependency constraints, <command>apt-get</command> selects the
  37. version with the highest priority for installation.
  38. The APT preferences override the priorities that APT assigns to
  39. package versions by default, thus giving the user control over which
  40. one is selected for installation.</para>
  41. <para>Several instances of the same version of a package may be available when
  42. the &sources-list; file contains references to more than one source.
  43. In this case <command>apt-get</command> downloads the instance listed
  44. earliest in the &sources-list; file.
  45. The APT preferences do not affect the choice of instance, only
  46. the choice of version.</para>
  47. <para>Preferences are a strong power in the hands of a system administrator
  48. but they can become also their biggest nightmare if used without care!
  49. APT will not question the preferences, so wrong settings can
  50. lead to uninstallable packages or wrong decisions while upgrading packages.
  51. Even more problems will arise if multiple distribution releases are mixed
  52. without a good understanding of the following paragraphs.
  53. Packages included in a specific release aren't tested in (and
  54. therefore don't always work as expected in) older or newer releases, or
  55. together with other packages from different releases.
  56. You have been warned.</para>
  57. <para>Note that the files in the <filename>/etc/apt/preferences.d</filename>
  58. directory are parsed in alphanumeric ascending order and need to obey the
  59. following naming convention: The files have either no or "<literal>pref</literal>"
  60. as filename extension and only contain alphanumeric, hyphen (-),
  61. underscore (_) and period (.) characters.
  62. Otherwise APT will print a notice that it has ignored a file, unless that
  63. file matches a pattern in the <literal>Dir::Ignore-Files-Silently</literal>
  64. configuration list - in which case it will be silently ignored.</para>
  65. <refsect2><title>APT's Default Priority Assignments</title>
  66. <para>If there is no preferences file or if there is no entry in the file
  67. that applies to a particular version then the priority assigned to that
  68. version is the priority of the distribution to which that version
  69. belongs. It is possible to single out a distribution, "the target release",
  70. which receives a higher priority than other distributions do by default.
  71. The target release can be set on the <command>apt-get</command> command
  72. line or in the APT configuration file <filename>/etc/apt/apt.conf</filename>.
  73. Note that this has precedence over any general priority you set in the
  74. <filename>/etc/apt/preferences</filename> file described later, but not
  75. over specifically pinned packages.
  76. For example,
  77. <programlisting>
  78. <command>apt-get install -t testing <replaceable>some-package</replaceable></command>
  79. </programlisting>
  80. <programlisting>
  81. APT::Default-Release "stable";
  82. </programlisting>
  83. </para>
  84. <para>If the target release has been specified then APT uses the following
  85. algorithm to set the priorities of the versions of a package. Assign:
  86. <variablelist>
  87. <varlistentry>
  88. <term>priority 1</term>
  89. <listitem><simpara>to the versions coming from archives which in their <filename>Release</filename>
  90. files are marked as "NotAutomatic: yes" but <emphasis>not</emphasis> as "ButAutomaticUpgrades: yes"
  91. like the Debian <literal>experimental</literal> archive.</simpara></listitem>
  92. </varlistentry>
  93. <varlistentry>
  94. <term>priority 100</term>
  95. <listitem><simpara>to the version that is already installed (if any) and to the versions coming
  96. from archives which in their <filename>Release</filename> files are marked as "NotAutomatic: yes" and
  97. "ButAutomaticUpgrades: yes" like the Debian backports archive since <literal>squeeze-backports</literal>.
  98. </simpara></listitem>
  99. </varlistentry>
  100. <varlistentry>
  101. <term>priority 500</term>
  102. <listitem><simpara>to the versions that do not belong to the target release.</simpara></listitem>
  103. </varlistentry>
  104. <varlistentry>
  105. <term>priority 990</term>
  106. <listitem><simpara>to the versions that belong to the target release.</simpara></listitem>
  107. </varlistentry>
  108. </variablelist>
  109. The highest of those priorities whose description matches the version is assigned to the
  110. version.
  111. </para>
  112. <para>If the target release has not been specified then APT simply assigns
  113. priority 100 to all installed package versions and priority 500 to all
  114. uninstalled package versions, except versions coming from archives which
  115. in their <filename>Release</filename> files are marked as "NotAutomatic: yes" -
  116. these versions get the priority 1 or priority 100 if it is additionally marked
  117. as "ButAutomaticUpgrades: yes".</para>
  118. <para>APT then applies the following rules, listed in order of precedence,
  119. to determine which version of a package to install.
  120. <itemizedlist>
  121. <listitem><simpara>Never downgrade unless the priority of an available
  122. version exceeds 1000. ("Downgrading" is installing a less recent version
  123. of a package in place of a more recent version. Note that none of APT's
  124. default priorities exceeds 1000; such high priorities can only be set in
  125. the preferences file. Note also that downgrading a package
  126. can be risky.)</simpara></listitem>
  127. <listitem><simpara>Install the highest priority version.</simpara></listitem>
  128. <listitem><simpara>If two or more versions have the same priority,
  129. install the most recent one (that is, the one with the higher version
  130. number).</simpara></listitem>
  131. <listitem><simpara>If two or more versions have the same priority and
  132. version number but either the packages differ in some of their metadata or the
  133. <literal>--reinstall</literal> option is given, install the uninstalled one.</simpara></listitem>
  134. </itemizedlist>
  135. </para>
  136. <para>In a typical situation, the installed version of a package (priority 100)
  137. is not as recent as one of the versions available from the sources listed in
  138. the &sources-list; file (priority 500 or 990). Then the package will be upgraded
  139. when <command>apt-get install <replaceable>some-package</replaceable></command>
  140. or <command>apt-get upgrade</command> is executed.
  141. </para>
  142. <para>More rarely, the installed version of a package is <emphasis>more</emphasis> recent
  143. than any of the other available versions. The package will not be downgraded
  144. when <command>apt-get install <replaceable>some-package</replaceable></command>
  145. or <command>apt-get upgrade</command> is executed.</para>
  146. <para>Sometimes the installed version of a package is more recent than the
  147. version belonging to the target release, but not as recent as a version
  148. belonging to some other distribution. Such a package will indeed be upgraded
  149. when <command>apt-get install <replaceable>some-package</replaceable></command>
  150. or <command>apt-get upgrade</command> is executed,
  151. because at least <emphasis>one</emphasis> of the available versions has a higher
  152. priority than the installed version.</para>
  153. </refsect2>
  154. <refsect2><title>The Effect of APT Preferences</title>
  155. <para>The APT preferences file allows the system administrator to control the
  156. assignment of priorities. The file consists of one or more multi-line records
  157. separated by blank lines. Records can have one of two forms, a specific form
  158. and a general form.
  159. <itemizedlist>
  160. <listitem>
  161. <simpara>The specific form assigns a priority (a "Pin-Priority") to one or more
  162. specified packages with a specified version or version range. For example,
  163. the following record assigns a high priority to all versions of
  164. the <filename>perl</filename> package whose version number begins with "<literal>&good-perl;</literal>".
  165. Multiple packages can be separated by spaces.</simpara>
  166. <programlisting>
  167. Package: perl
  168. Pin: version &good-perl;*
  169. Pin-Priority: 1001
  170. </programlisting>
  171. </listitem>
  172. <listitem><simpara>The general form assigns a priority to all of the package versions in a
  173. given distribution (that is, to all the versions of packages that are
  174. listed in a certain <filename>Release</filename> file) or to all of the package
  175. versions coming from a particular Internet site, as identified by the
  176. site's fully qualified domain name.</simpara>
  177. <simpara>This general-form entry in the APT preferences file applies only
  178. to groups of packages. For example, the following record assigns a high
  179. priority to all package versions available from the local site.</simpara>
  180. <programlisting>
  181. Package: *
  182. Pin: origin ""
  183. Pin-Priority: 999
  184. </programlisting>
  185. <simpara>A note of caution: the keyword used here is "<literal>origin</literal>"
  186. which can be used to match a hostname. The following record will assign a high priority
  187. to all versions available from the server identified by the hostname "ftp.de.debian.org"</simpara>
  188. <programlisting>
  189. Package: *
  190. Pin: origin "ftp.de.debian.org"
  191. Pin-Priority: 999
  192. </programlisting>
  193. <simpara>This should <emphasis>not</emphasis> be confused with the Origin of a distribution as
  194. specified in a <filename>Release</filename> file. What follows the "Origin:" tag
  195. in a <filename>Release</filename> file is not an Internet address
  196. but an author or vendor name, such as "Debian" or "Ximian".</simpara>
  197. <simpara>The following record assigns a low priority to all package versions
  198. belonging to any distribution whose Archive name is "<literal>unstable</literal>".</simpara>
  199. <programlisting>
  200. Package: *
  201. Pin: release a=unstable
  202. Pin-Priority: 50
  203. </programlisting>
  204. <simpara>The following record assigns a high priority to all package versions
  205. belonging to any distribution whose Codename is "<literal>&testing-codename;</literal>".</simpara>
  206. <programlisting>
  207. Package: *
  208. Pin: release n=&testing-codename;
  209. Pin-Priority: 900
  210. </programlisting>
  211. <simpara>The following record assigns a high priority to all package versions
  212. belonging to any release whose Archive name is "<literal>stable</literal>"
  213. and whose release Version number is "<literal>&stable-version;</literal>".</simpara>
  214. <programlisting>
  215. Package: *
  216. Pin: release a=stable, v=&stable-version;
  217. Pin-Priority: 500
  218. </programlisting>
  219. </listitem>
  220. </itemizedlist>
  221. </para>
  222. </refsect2>
  223. <refsect2><title>Regular expressions and &glob; syntax</title>
  224. <para>
  225. APT also supports pinning by &glob; expressions, and regular
  226. expressions surrounded by slashes. For example, the following
  227. example assigns the priority 500 to all packages from
  228. experimental where the name starts with gnome (as a &glob;-like
  229. expression) or contains the word kde (as a POSIX extended regular
  230. expression surrounded by slashes).
  231. </para>
  232. <programlisting>
  233. Package: gnome* /kde/
  234. Pin: release a=experimental
  235. Pin-Priority: 500
  236. </programlisting>
  237. <para>
  238. The rule for those expressions is that they can occur anywhere
  239. where a string can occur. Thus, the following pin assigns the
  240. priority 990 to all packages from a release starting with &ubuntu-codename;.
  241. </para>
  242. <programlisting>
  243. Package: *
  244. Pin: release n=&ubuntu-codename;*
  245. Pin-Priority: 990
  246. </programlisting>
  247. <para>
  248. If a regular expression occurs in a <literal>Package</literal> field,
  249. the behavior is the same as if this regular expression were replaced
  250. with a list of all package names it matches. It is undecided whether
  251. this will change in the future; thus you should always list wild-card
  252. pins first, so later specific pins override it.
  253. The pattern "<literal>*</literal>" in a Package field is not considered
  254. a &glob; expression in itself.
  255. </para>
  256. </refsect2>
  257. <refsect2>
  258. <title>How APT Interprets Priorities</title>
  259. <para>
  260. Priorities (P) assigned in the APT preferences file must be positive
  261. or negative integers. They are interpreted as follows (roughly speaking):
  262. <variablelist>
  263. <varlistentry>
  264. <term>P &gt;= 1000</term>
  265. <listitem><simpara>causes a version to be installed even if this
  266. constitutes a downgrade of the package</simpara></listitem>
  267. </varlistentry>
  268. <varlistentry>
  269. <term>990 &lt;= P &lt; 1000</term>
  270. <listitem><simpara>causes a version to be installed
  271. even if it does not come from the target release,
  272. unless the installed version is more recent</simpara></listitem>
  273. </varlistentry>
  274. <varlistentry>
  275. <term>500 &lt;= P &lt; 990</term>
  276. <listitem><simpara>causes a version to be installed
  277. unless there is a version available belonging to the target release
  278. or the installed version is more recent</simpara></listitem>
  279. </varlistentry>
  280. <varlistentry>
  281. <term>100 &lt;= P &lt; 500</term>
  282. <listitem><simpara>causes a version to be installed
  283. unless there is a version available belonging to some other
  284. distribution or the installed version is more recent</simpara></listitem>
  285. </varlistentry>
  286. <varlistentry>
  287. <term>0 &lt; P &lt; 100</term>
  288. <listitem><simpara>causes a version to be installed
  289. only if there is no installed version of the package</simpara></listitem>
  290. </varlistentry>
  291. <varlistentry>
  292. <term>P &lt; 0</term>
  293. <listitem><simpara>prevents the version from being installed</simpara></listitem>
  294. </varlistentry>
  295. <varlistentry>
  296. <term>P = 0</term>
  297. <listitem><simpara>has undefined behaviour, do not use it.</simpara></listitem>
  298. </varlistentry>
  299. </variablelist>
  300. </para>
  301. <para>
  302. The first specific-form record matching an available package version determines
  303. the priority of the package version.
  304. Failing that, the priority of the package is defined as the maximum of all
  305. priorities defined by generic-form records matching the version.
  306. Records defined using patterns in the Pin field other than "*" are treated like
  307. specific-form records.
  308. </para>
  309. <para>For example, suppose the APT preferences file contains the three
  310. records presented earlier:</para>
  311. <programlisting>
  312. Package: perl
  313. Pin: version &good-perl;*
  314. Pin-Priority: 1001
  315. Package: *
  316. Pin: origin ""
  317. Pin-Priority: 999
  318. Package: *
  319. Pin: release unstable
  320. Pin-Priority: 50
  321. </programlisting>
  322. <para>Then:
  323. <itemizedlist>
  324. <listitem><simpara>The most recent available version of the <literal>perl</literal>
  325. package will be installed, so long as that version's version number begins
  326. with "<literal>&good-perl;</literal>". If <emphasis>any</emphasis> &good-perl;* version of <literal>perl</literal> is
  327. available and the installed version is &bad-perl;*, then <literal>perl</literal> will be
  328. downgraded.</simpara></listitem>
  329. <listitem><simpara>A version of any package other than <literal>perl</literal>
  330. that is available from the local system has priority over other versions,
  331. even versions belonging to the target release.
  332. </simpara></listitem>
  333. <listitem><simpara>A version of a package whose origin is not the local
  334. system but some other site listed in &sources-list; and which belongs to
  335. an <literal>unstable</literal> distribution is only installed if it is selected
  336. for installation and no version of the package is already installed.
  337. </simpara></listitem>
  338. </itemizedlist>
  339. </para>
  340. </refsect2>
  341. <refsect2>
  342. <title>Determination of Package Version and Distribution Properties</title>
  343. <para>The locations listed in the &sources-list; file should provide
  344. <filename>Packages</filename> and <filename>Release</filename> files
  345. to describe the packages available at that location. </para>
  346. <para>The <filename>Packages</filename> file is normally found in the directory
  347. <filename>.../dists/<replaceable>dist-name</replaceable>/<replaceable>component</replaceable>/<replaceable>arch</replaceable></filename>:
  348. for example, <filename>.../dists/stable/main/binary-i386/Packages</filename>.
  349. It consists of a series of multi-line records, one for each package available
  350. in that directory. Only two lines in each record are relevant for setting
  351. APT priorities:
  352. <variablelist>
  353. <varlistentry>
  354. <term>the <literal>Package:</literal> line</term>
  355. <listitem><simpara>gives the package name</simpara></listitem>
  356. </varlistentry>
  357. <varlistentry>
  358. <term>the <literal>Version:</literal> line</term>
  359. <listitem><simpara>gives the version number for the named package</simpara></listitem>
  360. </varlistentry>
  361. </variablelist>
  362. </para>
  363. <para>The <filename>Release</filename> file is normally found in the directory
  364. <filename>.../dists/<replaceable>dist-name</replaceable></filename>:
  365. for example, <filename>.../dists/stable/Release</filename>,
  366. or <filename>.../dists/&stable-codename;/Release</filename>.
  367. It consists of a single multi-line record which applies to <emphasis>all</emphasis> of
  368. the packages in the directory tree below its parent. Unlike the
  369. <filename>Packages</filename> file, nearly all of the lines in a <filename>Release</filename>
  370. file are relevant for setting APT priorities:
  371. <variablelist>
  372. <varlistentry>
  373. <term>the <literal>Archive:</literal> or <literal>Suite:</literal> line</term>
  374. <listitem><simpara>names the archive to which all the packages
  375. in the directory tree belong. For example, the line
  376. "Archive: stable" or
  377. "Suite: stable"
  378. specifies that all of the packages in the directory
  379. tree below the parent of the <filename>Release</filename> file are in a
  380. <literal>stable</literal> archive. Specifying this value in the APT preferences file
  381. would require the line:
  382. </simpara>
  383. <programlisting>
  384. Pin: release a=stable
  385. </programlisting>
  386. </listitem>
  387. </varlistentry>
  388. <varlistentry>
  389. <term>the <literal>Codename:</literal> line</term>
  390. <listitem><simpara>names the codename to which all the packages
  391. in the directory tree belong. For example, the line
  392. "Codename: &testing-codename;"
  393. specifies that all of the packages in the directory
  394. tree below the parent of the <filename>Release</filename> file belong to a version named
  395. <literal>&testing-codename;</literal>. Specifying this value in the APT preferences file
  396. would require the line:
  397. </simpara>
  398. <programlisting>
  399. Pin: release n=&testing-codename;
  400. </programlisting>
  401. </listitem>
  402. </varlistentry>
  403. <varlistentry>
  404. <term>the <literal>Version:</literal> line</term>
  405. <listitem><simpara>names the release version. For example, the
  406. packages in the tree might belong to Debian release
  407. version &stable-version;. Note that there is normally no version number for the
  408. <literal>testing</literal> and <literal>unstable</literal> distributions because they
  409. have not been released yet. Specifying this in the APT preferences
  410. file would require one of the following lines.
  411. </simpara>
  412. <programlisting>
  413. Pin: release v=&stable-version;
  414. Pin: release a=stable, v=&stable-version;
  415. Pin: release &stable-version;
  416. </programlisting>
  417. </listitem>
  418. </varlistentry>
  419. <varlistentry>
  420. <term>the <literal>Component:</literal> line</term>
  421. <listitem><simpara>names the licensing component associated with the
  422. packages in the directory tree of the <filename>Release</filename> file.
  423. For example, the line "Component: main" specifies that
  424. all the packages in the directory tree are from the <literal>main</literal>
  425. component, which entails that they are licensed under terms listed
  426. in the Debian Free Software Guidelines. Specifying this component
  427. in the APT preferences file would require the line:
  428. </simpara>
  429. <programlisting>
  430. Pin: release c=main
  431. </programlisting>
  432. </listitem>
  433. </varlistentry>
  434. <varlistentry>
  435. <term>the <literal>Origin:</literal> line</term>
  436. <listitem><simpara>names the originator of the packages in the
  437. directory tree of the <filename>Release</filename> file. Most commonly, this is
  438. <literal>Debian</literal>. Specifying this origin in the APT preferences file
  439. would require the line:
  440. </simpara>
  441. <programlisting>
  442. Pin: release o=Debian
  443. </programlisting>
  444. </listitem>
  445. </varlistentry>
  446. <varlistentry>
  447. <term>the <literal>Label:</literal> line</term>
  448. <listitem><simpara>names the label of the packages in the directory tree
  449. of the <filename>Release</filename> file. Most commonly, this is
  450. <literal>Debian</literal>. Specifying this label in the APT preferences file
  451. would require the line:
  452. </simpara>
  453. <programlisting>
  454. Pin: release l=Debian
  455. </programlisting>
  456. </listitem>
  457. </varlistentry>
  458. </variablelist>
  459. </para>
  460. <para>All of the <filename>Packages</filename> and <filename>Release</filename>
  461. files retrieved from locations listed in the &sources-list; file are stored
  462. in the directory <filename>/var/lib/apt/lists</filename>, or in the file named
  463. by the variable <literal>Dir::State::Lists</literal> in the <filename>apt.conf</filename> file.
  464. For example, the file
  465. <filename>debian.lcs.mit.edu_debian_dists_unstable_contrib_binary-i386_Release</filename>
  466. contains the <filename>Release</filename> file retrieved from the site
  467. <literal>debian.lcs.mit.edu</literal> for <literal>binary-i386</literal> architecture
  468. files from the <literal>contrib</literal> component of the <literal>unstable</literal>
  469. distribution.</para>
  470. </refsect2>
  471. <refsect2>
  472. <title>Optional Lines in an APT Preferences Record</title>
  473. <para>Each record in the APT preferences file can optionally begin with
  474. one or more lines beginning with the word <literal>Explanation:</literal>.
  475. This provides a place for comments.</para>
  476. </refsect2>
  477. </refsect1>
  478. <refsect1>
  479. <title>Examples</title>
  480. <refsect2>
  481. <title>Tracking Stable</title>
  482. <para>The following APT preferences file will cause APT to assign a
  483. priority higher than the default (500) to all package versions belonging
  484. to a <literal>stable</literal> distribution and a prohibitively low priority to
  485. package versions belonging to other <literal>Debian</literal> distributions.
  486. <programlisting>
  487. Explanation: Uninstall or do not install any Debian-originated
  488. Explanation: package versions other than those in the stable distro
  489. Package: *
  490. Pin: release a=stable
  491. Pin-Priority: 900
  492. Package: *
  493. Pin: release o=Debian
  494. Pin-Priority: -10
  495. </programlisting>
  496. </para>
  497. <para>With a suitable &sources-list; file and the above preferences file,
  498. any of the following commands will cause APT to upgrade to the
  499. latest <literal>stable</literal> version(s).
  500. <programlisting>
  501. apt-get install <replaceable>package-name</replaceable>
  502. apt-get upgrade
  503. apt-get dist-upgrade
  504. </programlisting>
  505. </para>
  506. <para>The following command will cause APT to upgrade the specified
  507. package to the latest version from the <literal>testing</literal> distribution;
  508. the package will not be upgraded again unless this command is given
  509. again.
  510. <programlisting>
  511. apt-get install <replaceable>package</replaceable>/testing
  512. </programlisting>
  513. </para>
  514. </refsect2>
  515. <refsect2>
  516. <title>Tracking Testing or Unstable</title>
  517. <para>The following APT preferences file will cause APT to assign
  518. a high priority to package versions from the <literal>testing</literal>
  519. distribution, a lower priority to package versions from the
  520. <literal>unstable</literal> distribution, and a prohibitively low priority
  521. to package versions from other <literal>Debian</literal> distributions.
  522. <programlisting>
  523. Package: *
  524. Pin: release a=testing
  525. Pin-Priority: 900
  526. Package: *
  527. Pin: release a=unstable
  528. Pin-Priority: 800
  529. Package: *
  530. Pin: release o=Debian
  531. Pin-Priority: -10
  532. </programlisting>
  533. </para>
  534. <para>With a suitable &sources-list; file and the above preferences file,
  535. any of the following commands will cause APT to upgrade to the latest
  536. <literal>testing</literal> version(s).
  537. <programlisting>
  538. apt-get install <replaceable>package-name</replaceable>
  539. apt-get upgrade
  540. apt-get dist-upgrade
  541. </programlisting>
  542. </para>
  543. <para>The following command will cause APT to upgrade the specified
  544. package to the latest version from the <literal>unstable</literal> distribution.
  545. Thereafter, <command>apt-get upgrade</command> will upgrade
  546. the package to the most recent <literal>testing</literal> version if that is
  547. more recent than the installed version, otherwise, to the most recent
  548. <literal>unstable</literal> version if that is more recent than the installed
  549. version.
  550. <programlisting>
  551. apt-get install <replaceable>package</replaceable>/unstable
  552. </programlisting>
  553. </para>
  554. </refsect2>
  555. <refsect2>
  556. <title>Tracking the evolution of a codename release</title>
  557. <para>The following APT preferences file will cause APT to assign a
  558. priority higher than the default (500) to all package versions belonging
  559. to a specified codename of a distribution and a prohibitively low priority to
  560. package versions belonging to other <literal>Debian</literal> distributions,
  561. codenames and archives.
  562. Note that with this APT preference APT will follow the migration of a release
  563. from the archive <literal>testing</literal> to <literal>stable</literal> and
  564. later <literal>oldstable</literal>. If you want to follow for example the progress
  565. in <literal>testing</literal> notwithstanding the codename changes you should use
  566. the example configurations above.
  567. <programlisting>
  568. Explanation: Uninstall or do not install any Debian-originated package versions
  569. Explanation: other than those in the distribution codenamed with &testing-codename; or sid
  570. Package: *
  571. Pin: release n=&testing-codename;
  572. Pin-Priority: 900
  573. Explanation: Debian unstable is always codenamed with sid
  574. Package: *
  575. Pin: release n=sid
  576. Pin-Priority: 800
  577. Package: *
  578. Pin: release o=Debian
  579. Pin-Priority: -10
  580. </programlisting>
  581. </para>
  582. <para>With a suitable &sources-list; file and the above preferences file,
  583. any of the following commands will cause APT to upgrade to the
  584. latest version(s) in the release codenamed with <literal>&testing-codename;</literal>.
  585. <programlisting>
  586. apt-get install <replaceable>package-name</replaceable>
  587. apt-get upgrade
  588. apt-get dist-upgrade
  589. </programlisting>
  590. </para>
  591. <para>The following command will cause APT to upgrade the specified
  592. package to the latest version from the <literal>sid</literal> distribution.
  593. Thereafter, <command>apt-get upgrade</command> will upgrade
  594. the package to the most recent <literal>&testing-codename;</literal> version if that is
  595. more recent than the installed version, otherwise, to the most recent
  596. <literal>sid</literal> version if that is more recent than the installed
  597. version.
  598. <programlisting>
  599. apt-get install <replaceable>package</replaceable>/sid
  600. </programlisting>
  601. </para>
  602. </refsect2>
  603. </refsect1>
  604. <refsect1>
  605. <title>Files</title>
  606. <variablelist>
  607. &file-preferences;
  608. </variablelist>
  609. </refsect1>
  610. <refsect1>
  611. <title>See Also</title>
  612. <para>&apt-get; &apt-cache; &apt-conf; &sources-list;
  613. </para>
  614. </refsect1>
  615. &manbugs;
  616. </refentry>