Purpose: This blog entry will show you the steps involved to switch from Debian’s classic ‘apt-get’ tool to ‘aptitude’. This blog assumes that you are familiar with ‘apt-get‘ tool on Debian systems. Somewhere along Debian Etch release, Debian Developer recommended to start using aptitude instead of apt-get. We won’t go into the details of the advantages of aptitude over apt-get. May be something for my future post. So let’s get switched!

Step 0: Make up your mind

This is the most important step according to me.Because once you switch it would not be a good idea to go back or even use both the tools together. Don’t mix using of both of them.

Note: There might be some way to switch back to apt-get from aptitude but I am don’t know about it. If I find out, I will post it here.

Step 1: Install aptitude

# apt-get install aptitude

Step 2: Tell aptitude to keep all the packages

# aptitude keep-all

If you don’t give the above command, aptitude will remove many packages from the system that it thinks are no longer required (because they were not installed using aptitude).

Step 3: You are ready to use aptitude

Congratulations! You are ready to start using aptitude now. Almost there…

Step 4: Switch

#aptitude update
#aptitude upgrade
#aptitude install <some-package>

That’s it! You have now officially switched to aptitude.

Some useful aptitude commands:

The good thing is that aptitude’s command line interface is very similar to apt-get, so it won’t take much time to get use to it. Here are some handy commands mostly taken from here:

* aptitude update: Update the local cache of available packages
Formerly: apt-get update

* aptitude upgrade: Upgrade available packages
Formerly: apt-get upgrade

* aptitude safe-upgrade: Upgrade available packages – Recommended
Formerly: apt-get upgrade

* aptitude dist-upgrade: Upgrade available packages even if it means removing stuff
Formerly: apt-get dist-upgrade

* aptitude install <pkgname> : Install package
Formerly: apt-get install

* aptitude remove <pkgname>: Uninstall package
Formerly: apt-get remove

* aptitude purge <pkgname>: Uninstall package and config files
Formerly: apt-get –purge remove

* aptitude search string: Search for a package with “string” in the name or description
Formerly: apt-cache search string

* aptitude show <pkgname> : Show detailed of a package Formerly: apt-cache show pkgname

* aptitude clean: Delete downloaded package files
Formerly: apt-get clean

* aptitude autoclean: Delete only out-of-date package files but keep current ones
Formerly: apt-get autoclean

* aptitude hold <pkgname> : Fix a package at its current version and don’t upgrade it automatically
Formerly: A crude method of echo-to-file command.

Here are some useful links if you would like to know more about aptitude v/s apt-get stuff:

http://pthree.org/2007/08/12/aptitude-vs-apt-get/

http://www.garfieldtech.com/blog/your-debian-aptitude

http://psychocats.net/ubuntu/aptitude

Happy aptitud’ing!

Be Sociable, Share!