Translation(s): Italiano - Português Brasileiro


APT (the Advanced Package Tool) is configured by several resources, including

in addition to the more detailed APT-conf configuration discussed below. Hence it's important to realize that, despite its name, APT-conf does not entirely configure your package management, just some parts of it.

APT-conf configuration

APT-conf must itself be configured :-) Like the rest of the APT configuration resources, APT-conf is configured by writing information to files in one of 2 ways:

  1. The newer, more easily extensible, preferred way: writing multiple files to a directory. For APT-conf, that directory is /etc/apt/apt.conf.d/.

  2. The old, deprecated way: writing all APT-conf information to a single file, /etc/apt/conf

APT-conf instructions

The following instructions

Debconf configuration is initiated with following line. There is no need to add it, as it is already there by default, it is shown here only as an example. The command in brackets could be any arbitrary command to be executed in shell.

 Dpkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";};

There are also options

 Dpkg::Pre-Invoke {"command";};
 Dpkg::Post-Invoke {"command";};

They execute commands before/after apt calls dpkg. One thing to note is that with Pre-Install-Pkgs deb package path is passed on to stdin from apt, eg. when installing package gnome the following is stdin of called command:


An example that sets default release to testing (you can also specify a codename as lenny or squeeze) :

 APT::Default-Release "testing";

You can use this example for HTTP proxy:

 Acquire::http::Proxy "http://proxy:8080";

And this one for FTP proxy (NOTE: Only change proxy hostname and port):

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

Here is a whole example apt.conf file using stable:

APT::Default-Release "stable";
APT::Cache-Limit 10000000;
//comment begins with //
//had problems with running MMap runs out of room, so add cache-limit//
APT::Cache-Limit "25165824";
//Server down takes too long, add timout
Acquire::http::Timeout "2";
Acquire::ftp::Timeout "2";