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. On the opposite, 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 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 YENDO MÁS ALLÁ Versiones antiguas de paquetes: snapshot.debian.org).
Ejemplo 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 o aptitude safe-upgrade (por supuesto, después de apt-get update). Esta orden busca paquetes instalados que pueden ser actualizados sin eliminar ningún paquete. En otras palabras, el objetivo es asegurar la actualización menos intrusiva posible. apt-get es ligeramente más exigente que aptitude o apt ya que se negará a instalar paquetes que no estaban instalados previamente.
apt generalmente seleccionará el número de versión más reciente (excepto para paquetes en Experimental y stable-backports, que son ignorados de forma predeterminada sin importar su número de versión). Si especificó Testing o Unstable en su archivo sources.list, apt upgrade cambiará la mayor parte de su sistema en Stable a Testing o Unstable, lo que podría no ser lo deseado.
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. Con esta instrucción, apt completará la actualización aún si tiene que eliminar algunos paquetes obsoletos o instalar nuevas dependencias. Esta también es la orden utilizada por los usuarios que trabajan diariamente con la versión Unstable de Debian y siguen su evolución día a día. Es tan simple que casi no necesita explicación: la reputación de APT está basada en esta excelente característica.
apt y aptitude, apt-get no sabe cómo hacer full-upgrade command. En su lugar debería usar apt-get dist-upgrade (”distribution upgrade”), la histórica y bien conocida orden que apt y aptitude también aceptan para satisfacer a los usuarios que están acostumbrados a usarla.
/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://su-proxy:3128". Para un proxy FTP, utilice Acquire::ftp::proxy "ftp://su-proxy". Para descubrir más opciones de configuración, lea la página de manual apt.conf(5) con la orden man apt.conf (para detalles sobre las páginas de manual, revise la Sección 7.1.1, “Páginas de manual”).
-t o la directiva de configuración APT::Default-Release).
/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, 10 for Debian Buster). Let's have a look at its syntax through some realistic case studies of this mechanism.
/etc/apt/preferences:
Package: * Pin: release a=stable Pin-Priority: 900 Package: * Pin: release o=Debian Pin-Priority: -10
a=stable define el nombre de la distribución elegida. o=Debian limita el alcance a los paquetes cuyo origen es «Debian».
Package: perl Pin: version 5.24* 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 SUGERENCIA apt-cache policy.
/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 es, es tentador elegir paquetes de otras distribuciones. Por ejemplo, tras instalar un sistema Stable podría desear probar paquetes de software disponibles en Testing o Unstable sin desviarse demasiado del estado inicial del sistema.
apt gestionará muy bien su coexistencia y limitará los riesgos de manera muy efectiva. La mejor manera de proceder es listar todas las distribuciones utilizadas en /etc/apt/sources.list (algunas personas siempre agregan las tres distribuciones, pero recuerde que Unstable está reservado para usuarios experimentados) y definir su distribución de referencia con el parámetro APT::Default-Release (revise la Sección 6.2.3, “Actualización del sistema”).
sources.list. En este caso, puede utilizar apt install paquete/testing para instalar un paquete de Testing. Si la instalación falla debido a alguna dependencia insatisfecha, permítale resolver esas dependencias dentro de Testing agregando el parámetro -t testing. Obviamente, lo mismo aplica a Unstable.
upgrade y full-upgrade) se realizan dentro de Stable a excepción de los paquetes que ya fueron actualizados a otra distribución: éstos seguirán las actualizaciones disponibles en las otras distribuciones. Explicaremos este comportamiento con la ayuda de las prioridades predeterminadas de APT a continuación. No dude en utilizar apt-cache policy (revise el recuadro SUGERENCIA apt-cache policy) para verificar las prioridades otorgadas.
/etc/apt/preferences no ha sido usado para forzar prioridades superiores a 1000 para algunos paquetes).
/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 paquete marcará el paquete dado como automático mientras que apt-mark manual paquete realiza lo opuesto. aptitude markauto y aptitude unmarkauto funcionan de la misma forma, pero ofrecen más funcionalidad para marcar varios paquetes simultáneamente (revise la Sección 6.5.1, “aptitude”). La interfaz interactiva para la consola de aptitude también facilita el revisar la «marca automática» en muchos paquetes.
aptitude why paquete (apt y apt-get no poseen una funcionalidad similar):
$aptitude why python-debiani aptitude Suggests apt-xapian-index p apt-xapian-index Depends python-debian (>= 0.1.14)