apt-get
is the first front end — command-line based — which was developed within the project. apt
is a second command-line based front end provided by APT which overcomes some design mistakes of apt-get
.
apt
has been improved for interactive use and to actually do what most users expect. The APT developers reserve the right to change the public interface of this tool to further improve it. Conversely, the public interface of apt-get
is well defined and will not change in any backwards incompatible way. It is thus the tool that you want to use when you need to script package installation requests.
synaptic
, aptitude
(which includes both a text mode interface and a graphical one — even if not complete yet), wajig
, etc. The most recommended interface, apt
, is the one that we will use in the examples given in this section. Note, however, that apt-get
and aptitude
have a very similar command line syntax. When there are major differences between these three commands, these will be detailed.
apt update
. Depending on the speed of your connection and configuration, the operation can take a while, since it involves downloading a certain number of (usually compressed) files (Packages
, Sources
, Translation-language-code
), which have gradually become bigger and bigger as Debian has developed (at least 10-16 MB of data for the main
section). Of course, installing from a CD-ROM/DVD set does not require any downloading — in this case, the operation is very fast.
apt install package
and apt remove package
. In both cases, APT will automatically install the necessary dependencies or delete the packages which depend on the package that is being removed. The apt purge package
command involves a complete uninstallation by deleting the configuration files as well.
sources.list
mentions several distributions, it is possible to give the version of the package to install. A specific version number can be requested with apt install package=version
, but indicating its distribution of origin (Stable, Testing or Unstable) — with apt install package/distribution
— is usually preferred. With this command, it is possible to go back to an older version of a package (if, for instance, you know that it works well), provided that it is still available in one of the sources referenced by the sources.list
file. Otherwise the snapshot.debian.org
archive can come to the rescue (see sidebar GOING FURTHER Old package versions: snapshot.debian.org
and archive.debian.org
).
Voorbeeld 6.4. Installation of the Unstable version of spamassassin
#
apt install spamassassin/unstable
.deb
file without any associated package repository, it is still possible to use APT to install it together with its dependencies (provided that the dependencies are available in the configured repositories) with a simple command: apt install ./path-to-the-package.deb
. The leading ./
is important to make it clear that we are referring to a filename and not to the name of a package available in one of the repositories.
apt upgrade
, apt-get upgrade
of aptitude safe-upgrade
(natuurlijk na apt update
). Dit commando zoekt naar geïnstalleerde pakketten die opgewaardeerd kunnen worden zonder enig pakket te verwijderen. Met andere woorden, het doel is om de minst ingrijpende opwaardering te verzekeren. apt-get
is iets minder veeleisend dan aptitude
of apt
omdat het zal weigeren om pakketten te installeren die niet op voorhand geïnstalleerd waren.
apt
zal in het algemeen de meest recente versie nummer selecteren (behalve voor pakketten van Experimenteel en stable-backports, welke standaard genegeerd worden ongeacht hun versie nummer). Als je Testing of Unstable in jou sources.list
gespecificeerd hebt zal apt upgrade
de meeste van jouw Stabiele systeem naar Testen of Onstabiel omschakelen, wat je misschien niet bedoeld zou hebben.
apt
to use a specific distribution when searching for upgraded packages, you need to use the -t
or --target-release
option, followed by the name of the distribution you want (for example, apt -t stable upgrade
). To avoid specifying this option every time you use apt
, you can add APT::Default-Release "stable";
in the file /etc/apt/apt.conf.d/local
.
apt full-upgrade
gebruiken. Met deze instructie, zal apt
de opwaardering volledig uitvoeren ook als het bepaalde verouwderde pakketten moet verwijderen of nieuwe afhankelijkheden moet installeren. Dit is ook het commando gebruikt door gebruikers die dagelijks werken met Debian Onstabiel vrijgave en haar evolutie dag-na-dag volgen. Het is zo gemakkelijk dat het amper uitleg nodig heeft: de reputatie van APT is grotendeels gebaseerd op deze functionaliteit.
apt
en aptitude
, kent apt-get
het commando full-upgrade
niet. Je zouw in de plaats apt-get dist-upgrade
(”distribution upgrade”) moeten gebruiken. Het historische en goed-gekende commando dat apt
en aptitude
ook accepteren voor het gemak van de gebruikers die dit gewoon zijn.
/var/log/apt/history.log
and /var/log/apt/term.log
, whereas dpkg
keeps its log in a file called /var/log/dpkg.log
.
/etc/apt/apt.conf.d/
directory or /etc/apt/apt.conf
itself. Remember, for instance, that it is possible for APT to tell dpkg
to ignore file conflict errors by specifying DPkg::options { "--force-overwrite"; }
.
Acquire::http::proxy "http://yourproxy:3128"
. For an FTP proxy, write Acquire::ftp::proxy "ftp://yourproxy"
. To discover more configuration options, read the apt.conf(5) manual page (for details on manual pages, see Paragraaf 7.1.1, “Handleiding Pagina's”).
-t
commando-regel optie of de APT::Default-Release
configuratie richtlijn).
/etc/apt/preferences.d/
or the /etc/apt/preferences
file with the names of the affected packages, their version, their origin and their new priority.
/etc/apt/preferences
and /etc/apt/preferences.d/
, it first takes into account the most specific entries (often those specifying the concerned package), then the more generic ones (including, for example, all the packages of a distribution). If several generic entries exist, the first match is used. The available selection criteria include the package's name and the source providing it. Every package source is identified by the information contained in a Release
file that APT downloads together with the Packages
files. It specifies the origin (usually “Debian” for the packages of official mirrors, but it can also be a person's or an organization's name for third-party repositories). It also gives the name of the distribution (usually Stable, Testing, Unstable or Experimental for the standard distributions provided by Debian) together with its version (for example, 11 for Debian Bullseye). Let's have a look at its syntax through some realistic case studies of this mechanism.
/etc/apt/preferences
bestand kunnen zetten:
Package: * Pin: release a=stable Pin-Priority: 900 Package: * Pin: release o=Debian Pin-Priority: -10
a=stable
definieert de naam van de geselecteerde distributie. o=Debian
limiteert het bereik tot pakketten waarvan de oorsprong “Debian” is.
Package: perl Pin: version 5.28* Pin-Priority: 1001
apt-cache policy
to display the default priority associated with each package source, or apt-cache policy package
to display the default priority for each available version and source of a package as explained in Paragraaf 6.3.1, “The apt-cache policy
Command”.
/etc/apt/preferences
and /etc/apt/preferences.d/
is available in the manual page apt_preferences(5), which you can display with man apt_preferences
.
apt
is zo'n geweldig gereedschap, het is verleidelijk om pakketten te kiezen die van andere distributies komen. Bijvoorbeeld, na een Stabiel systeem geïnstalleerd te gebben, wil je misschien een software pakket uit Testen probren of Onstabiel zonder ver van de originele staat af te wijken.
apt
dergelijk gelijktijdig bestaande pakketten zeer goed en beperkt de risico's zeer effectief. De beste manier om verder te gaan is al de gebruikte distributies invoeren in /etc/apt/sources.list
(sommige mensen plaatsen er altijd alle drie de distributies, maar onthoudt dat Onstabiel gereserveerd is voor ervaren gebruikers) en jouw referentie distributie definiëren met de APT::Default-Release
parameter (zie Paragraaf 6.2.3, “Systeem Opwaarderen”).
sources.list
bestand staan. In dat geval kun je apt install pakket/testing
gebruiken om een pakket van Testen te installeren. Als de installatie faalt door een onvoldane afhankelijkheid, lossen we deze afhankelijkheid op binnen Testen door de -t testing
parameter toe te voegen. Het zelfde geldt natuurlijk voor Onstabiel.
upgrade
and full-upgrade
) are done within Stable except for packages already upgraded to another distribution: those will follow updates available in the other distributions. We will explain this behavior with the help of the default priorities set by APT below. Do not hesitate to use apt-cache policy
(Paragraaf 6.3.1, “The apt-cache policy
Command”) to verify the given priorities.
/etc/apt/preferences
niet gebruikt wordt om priotiteiten hoger dan 1000 voor bepaalde pakketten te forceren).
/etc/apt/preferences
to this effect:
Package: * Pin: release a=unstable Pin-Priority: 490
apt
is the tracking of packages installed only through dependencies. These packages are called “automatic”, and often include libraries.
apt-get autoremove
or apt autoremove
will get rid of those packages. aptitude
does not have this command because it removes them automatically as soon as they are identified. In all cases, the tools display a clear message listing the affected packages.
apt-mark auto pakket
zal het gegeven pakket markeren als automatisch, waar apt-mark manual pakket
het tegenovergestelde doet. aptitude markauto
en aptitude unmarkauto
werken op dezelfde manier, hoewel ze meer functies bieden voor het gelijktijdig markeren van meerdere pakketten (zie Paragraaf 6.5.1, “aptitude
”). De console-gebaseerde interactieve interface van aptitude
maakt het ook gemakkelijk om de “automatisch vlag” van meerdere pakketten te bekijken.
aptitude why pakket
(apt
en apt-get
hebben geen gelijkaardig commando) gebruiken:
$
aptitude why python3-debian
i aptitude Suggests apt-xapian-index p apt-xapian-index Depends python3-debian (>= 0.1.14)
aptitude
, synaptic
”), but now APT can also make use of them.
apt list ?automatic
to list all the packages automatically installed. To find packages automatically installed no longer depended upon by manually installed packages the pattern ?garbage
can be used.
?and(PATTERN, PATTERN)
. See apt-patterns(7) and glob(7) for all the patterns you can use and the complex expressions you can create with them.