Thursday, February 17, 2011

Aptitude vs Apt-get Comparison

One of the many attractive features of Ubuntu and Debian Linux is the package management system. Coming from other operating systems and other distributions makes the discovery of the Advanced Packaging Tool, APT, a source of pleasure and delight. Here is a system that solves dependency hell, makes keeping soft up to date easy and facilitates simple installation and removal of software packages.
The mainstay of this system has been apt-get, an extremely useful and versatile program that has been the heart of the Debian APT system. A great and useful program, but not perfect, the newer program aptitude is the result of an effort to improve on apt-get. In addition to a cleaner command line interface, aptitude offers a fullscreen character-based UI and more complete tracking of what has been installed and interdependencies.
aptitude is a newer and improved replacement for apt-get
These two programs provides higher level capabilities compared to dpkg, the Debian low-level package management utility. They offer an interface to package repositories and provide relief from dependency hell.
featureapt-get commandaptitude command
fullscreen interfaceN/Aaptitude
install packageapt-get install ‘pkgname’aptitude install ‘pkgname’
remove packageapt-get remove ‘pkgname’aptitude remove ‘pkgname’
purge package (removes package
and installation files)
apt-get –purge remove ‘pkgname’aptitude purge ‘pkgname’
upgrade installed packagesapt-get upgradeaptitude upgrade
upgrade installed packages
even if other packages
must be removed
apt-get dist-upgradeaptitude dist-upgrade
show package details(apt-cache show ‘pkgname’)aptitude show ‘pkgname’
search for packages(apt-file ‘searchpattern’)aptitude search ‘searchpattern’
delete installation filesapt-get cleanaptitude clean
delete obsolete installation filesapt-get autocleanaptitude autoclean
update local cache of
available packages
apt-get updateaptitude update
Show package detailsapt-get show ‘pkgname’aptitude show ‘pkgname’
Retain the current version
of a package going forward
N/Aaptitude hold pkgname
Clear the hold on a
package from
‘aptitude hold pkgname’ command
N/Aaptitude unhold pkgname
List reverse dependenciesapt-cache rdepends packagenameaptitude -D packagename
super cow powersapt-get mooaptitude -v[v[v[v[v]]]] moo
As you can see, in addition to a more complete dependency tracking solution, aptitude also provides a (well designed) full-screen interface and cleaned-up command line syntax. Also, contrary to reports elsewhere, aptitude offers the ever important super cow functionality, with sarcasm added (Easter egg).
When installing a package, aptitude will show which other packages, though not required, are recommended or suggested, so you can decide whether or not to also install those.
Because aptitude more completely track dependencies, if you use it exclusively your will not need to use deborphan or debfoster.
Apt-get does not remove packages it installed as dependencies when the package you specified to be installed is removed. Aptitude does remove unneeded dependencies. This basic difference can cause problems when switching from apt-get to aptitude.

Don’t use both apt-get and aptitude interchangeably

Use one or the other. I’ve switched completely from using apt-get to using aptitude. If you do use apt-get, afterward run aptitude and fix any problems detected by first pressing g, which will show broken dependencies and packages that aptitude would remove. If you want to retain the packages that would be removed, arrow down to the header of that category and press the + key. Pressing g again will update your system with your indicated changes.
There is a difference in how aptitude keeps track of installed packages and their dependencies compared to apt-get. Aptitude is more precise is tracking these dependencies. Consequently, when you switch from using apt-get to aptitude, the first time you use aptitude you can run into problems because it can remove needed packages because it does not know that they are needed. This can be resolved through aptitudes’s full-screen interface or by entering the following command:

$sudo aptitude keep-all

This will cause aptitude to retain all current packages going forward.

Aptitude’s full-screen interface

As displayed in the comparison table, aptitude offers a character-based full-screen interactive user interface if aptitude is entered as a command with no options.
The interface is very well designed and implemented, logical and easy to use after a few minutes of examination and trial. It has a drop-down menu system, which I found to work well using a mouse. The help system can be access via the drop-down menu or by pressing the ‘?’ key. A plethora of options are presented, most of which will make sense from what you’ve seen in the command line operation of the program. Pressing ‘q’ exits help…indeed pressing ‘q’ is the way to exit other modes in the program and exiting the program itself.

Other thoughts

I’ve found aptitude to be so well done, that I use it for all my package management needs. I use Synaptic to help search for software sometimes, whether for my local machine or a server. Then, I install it with aptitude…in any case Synaptic would be pretty useless over SSH to a server.

No comments:

Post a Comment