Differences between revisions 9 and 10
Revision 9 as of 2019-08-23 18:03:31
Size: 2121
Editor: nodiscc
Comment: WIP merge AptPreferences, add manpage links
Revision 10 as of 2019-08-23 18:42:34
Size: 3102
Editor: nodiscc
Comment: Pinning, priorities, DontBreakDebian, PackageManagementTools, DebianBackports
Deletions are marked like this. Additions are marked like this.
Line 52: Line 52:
=== apt_preferences === == apt_preferences ==
Line 56: Line 56:
=== Apt pinning ===
Line 57: Line 58:
=== Command line options === When multiple Apt repositories are enabled, a package can be present in several of them. To know which one should be installed, Apt assigns '''priorities''' to packages. The default is {{{500}}}.

 * If the packages have the same priority, the package with a higher version number (most recent) wins.
 * If packages have different priorities, the one with the higher priority wins.

'''Pinning''' allows changing priorities for only some packages/repositories, so that you can:


 * Prefer a DebianBackports package over a Stable one: by default DebianBackports repositories have a lower priority than stable ({{{100}}}). They won't be installed unless explicitely configured to (or the package only exists in backports).
 * Prefer a DebianStable package over an experimental/unstable repo: you may want to prevent installation of more recent packages from a third party source, while only allowing some of them. '''See DontBreakDebian.'''







== Command line options ==

WIP: refactoring of https://wiki.debian.org/AptConf and other apt configuration pages


Apt is configured by several resources, including:

  • command-line options
  • ?AptKeys

  • apt_preferences
  • AptSources

  • apt.conf

apt.conf

See man 5 apt.conf

Apt accepts configuration files (without extension) in /etc/apt/apt.conf.d/. These are processed by Apt in numeric/alphabetical order. /etc/apt/apt.conf is also valid but deprecated.

These files can contain various directives:

  • Dpkg::Pre-Install-Pkgs {"mycommand";};: executes mycommand before package installation/unpacking by Dpkg.

  • Dpkg::Pre-Invoke {"mycommand";};: executes mycommand before apt calls dpkg

  • Dpkg::Post-Invoke {"mycommand";};: executes mycommand after apt calls dpkg

  • Pre-Install-Pkgs: ??? TODO

  • APT::Default-Release "testing";: sets the default Debian release used by Apt (TODO use case?)

  • APT::Cache-Limit 10000000;: ??? TODO

  • Apt::Get::Purge;: ??? TODO

  • Acquire::http::Proxy "http://proxy:8080";: sets the proxy for HTTP downloads

  • Acquire::https::Proxy "https://proxy:8443";: sets the proxy for HTTPS downloads

  • Acquire::http::Timeout "2";: sets the timeout for HTTP downloads

  • Acquire::https::Timeout "2";: sets the timeout for HTTPS downloads

  • Acquire::ftp::Timeout "2";: sets the timeout for FTP downloads

If you really have to use FTP, this sets the FTP proxy:

 Acquire::ftp
 {
   Proxy "ftp://proxy:2121/";
   ProxyLogin
   {
      "USER $(SITE_USER)@$(SITE)";
      "PASS $(SITE_PASS)";
   }
 }

apt_preferences

See man 5 apt_preferences

Apt pinning

When multiple Apt repositories are enabled, a package can be present in several of them. To know which one should be installed, Apt assigns priorities to packages. The default is 500.

  • If the packages have the same priority, the package with a higher version number (most recent) wins.
  • If packages have different priorities, the one with the higher priority wins.

Pinning allows changing priorities for only some packages/repositories, so that you can:

  • Prefer a DebianBackports package over a Stable one: by default DebianBackports repositories have a lower priority than stable (100). They won't be installed unless explicitely configured to (or the package only exists in backports).

  • Prefer a DebianStable package over an experimental/unstable repo: you may want to prevent installation of more recent packages from a third party source, while only allowing some of them. See DontBreakDebian.

Command line options

PackageManagementTools such as apt, aptitude, apt-get... allow you to set specific configuration options for a single run. See their respective ?ManPages.