Aptitude vs Apt-get
Este es algo que tenía como borrador hace mucho tiempo. Es algo que siempre me toca conversar con mas de alguien o una pregunta que he tenido que responder varias veces. Así que pretendo escribir esto aquí para por si alguien tenga la duda pueda aclarar la inquietud. Es el tipica pregunta sobre aptitude vs apt-get
¿Que usar, aptitude o apt-get?, Si tienes que elegir entre los dos mejor usa aptitude
apt-get como aptitude son sistemas para la administración de paquetes en un sistema Debian. En definitiva, ambos son interfaces para el sistema APT. Te permiten agregar, eliminar y hacer otras operaciones con el sistema de paquetes (software).
El principal motivo porque usa aptitude en vez de apt-get es que por naturaleza aptitude mantiene el sistema limpio. ¿A que me refiero con esto?, vamos a poner el siguiente ejemplo:
Vamos a instalar un paquete llamado ndiff, ese software en Debian depende directamente de python-lxml que a su ves tiene otras dependencias. Vamos a ver la información de ndiff con apt-cache
astdev# apt-cache show ndiff Package: ndiff Source: nmap Version: 6.47-3 Installed-Size: 283 Maintainer: Hilko Bengen <bengen@debian.org> Architecture: all Depends: python:any, python-lxml Recommends: nmap Conflicts: nmap (<< 6.47-3) Description-en: The Network Mapper - result compare utility Ndiff is a tool to aid in the comparison of Nmap scans. It takes two Nmap XML output files and prints the differences between them. Description-md5: fa4c40a47b4d409b014035b267f7cc94 Section: net Priority: extra Filename: pool/main/n/nmap/ndiff_6.47-3_all.deb Size: 246668 MD5sum: 93e6027244d23b8c16d6a351e705a90d SHA1: 353cf97769c6456c9962918788ed217a88620fae SHA256: c7e55275ec7097ebc1400bca5fb651638285bd968163628dad79f0f6e8c01a1a
Ahora vamos a instalar y desintalar usando aptitude.
astdev# aptitude install ndiff The following NEW packages will be installed: libblas-common{a} libblas3{a} libgfortran3{a} liblinear1{a} liblua5.2-0{a} libpcap0.8{a} ndiff nmap{a} python-lxml{a} 0 packages upgraded, 9 newly installed, 0 to remove and 45 not upgraded. Need to get 5,645 kB of archives. After unpacking 23.5 MB will be used. Do you want to continue? [Y/n/?] Get: 1 http://ftp.us.debian.org/debian/ jessie/main libgfortran3 i386 4.9.2-10 [235 kB] Get: 2 http://ftp.us.debian.org/debian/ jessie/main libblas-common i386 1.2.20110419-10 [8,486 B] Get: 3 http://ftp.us.debian.org/debian/ jessie/main libblas3 i386 1.2.20110419-10 [143 kB] Get: 4 http://ftp.us.debian.org/debian/ jessie/main liblinear1 i386 1.8+dfsg-4 [33.4 kB] Get: 5 http://ftp.us.debian.org/debian/ jessie/main liblua5.2-0 i386 5.2.3-1.1 [92.0 kB] Get: 6 http://ftp.us.debian.org/debian/ jessie/main libpcap0.8 i386 1.6.2-2 [137 kB] Get: 7 http://ftp.us.debian.org/debian/ jessie/main python-lxml i386 3.4.0-1 [762 kB] Get: 8 http://ftp.us.debian.org/debian/ jessie/main ndiff all 6.47-3 [247 kB] Get: 9 http://ftp.us.debian.org/debian/ jessie/main nmap i386 6.47-3+b1 [3,988 kB]
Podemos ver como se instala las libs y paquetes adicionales, en este caso libblas-common libblas3 libgfortran3 liblinear1 liblua5.2-0 libpcap0.8{a} ndiff nmap python-lxml
El caso es cuando desinstalamos con aptitude si las libs que depende el paquete a remover no son requeridas por otro software en el sistema estas son removidas también. Esto lo podemos ver acontinuación
astdev# aptitude remove ndiff The following packages will be REMOVED: libblas-common{u} libblas3{u} libgfortran3{u} liblinear1{u} liblua5.2-0{u} libpcap0.8{u} ndiff nmap{u} 0 packages upgraded, 0 newly installed, 8 to remove and 45 not upgraded. Need to get 0 B of archives. After unpacking 20.5 MB will be freed. Do you want to continue? [Y/n/?] (Reading database ... 77209 files and directories currently installed.) Removing nmap (6.47-3+b1) ... Removing liblinear1:i386 (1.8+dfsg-4) ... Removing libblas3 (1.2.20110419-10) ... Removing libblas-common (1.2.20110419-10) ... Removing libgfortran3:i386 (4.9.2-10) ... Removing liblua5.2-0:i386 (5.2.3-1.1) ... Removing libpcap0.8:i386 (1.6.2-2) ... Removing ndiff (6.47-3) ... Processing triggers for man-db (2.7.0.2-5) ... Processing triggers for libc-bin (2.19-18) ...
Apt-get
Ahora realizaremos lo mismo hecho con aptitude con apt-get
Instalar ndiff con apt-get
apt-get install ndiff Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: libblas-common libblas3 libgfortran3 liblinear1 liblua5.2-0 libpcap0.8 nmap Suggested packages: liblinear-tools liblinear-dev The following NEW packages will be installed: libblas-common libblas3 libgfortran3 liblinear1 liblua5.2-0 libpcap0.8 ndiff nmap 0 upgraded, 8 newly installed, 0 to remove and 45 not upgraded. Need to get 0 B/4,883 kB of archives. After this operation, 20.5 MB of additional disk space will be used. Do you want to continue? [Y/n]
Ahora lo interesante y el motivo de este artículo es cuando se elimina con apt-get ndiff. Veamos que sucede.
apt-get remove ndiff Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libblas-common libblas3 libgfortran3 liblinear1 liblua5.2-0 libpcap0.8 nmap Use 'apt-get autoremove' to remove them. The following packages will be REMOVED: ndiff 0 upgraded, 0 newly installed, 1 to remove and 45 not upgraded. After this operation, 290 kB disk space will be freed. Do you want to continue? [Y/n] (Reading database ... 77209 files and directories currently installed.) Removing ndiff (6.47-3) ... Processing triggers for man-db (2.7.0.2-5) ...
Como se puede ver solo quito del sistema ndiff pero las dependencias que tiene dicho software se quedan en el sistema.
Como nota aparte, desde Ubuntu 6.10 apt-get usa misma forma para mantener el sistema limpio, para eso al desintalar se debe usar:
apt-get autoremove Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: libblas-common libblas3 libgfortran3 liblinear1 liblua5.2-0 libpcap0.8 nmap 0 upgraded, 0 newly installed, 7 to remove and 45 not upgraded. After this operation, 20.2 MB disk space will be freed. Do you want to continue? [Y/n]
Aptitude vs apt-get? como conclusión en mi caso siempre y trato en lo posible de utilizar aptitude