COURSE of the MONTH

apg-get vs aptitude vs dpkg -i

I'm new to ubuntu and got confused in ubuntu. I'm familiar with centos/redhat rpm and yum command. When I look at the ubuntu there are 3 ways we can install. What are the difference between apg-get install , aptitude install and dpkg -i

Who is Participating?

The only difference is the command and the options to install a package. apt-get, aptitude and dpkg all can install packages. That was the short answer. The long one is:

There are multiple tools that are used to manage Debian packages, from graphic or text-based interfaces to the low level tools used to install packages. All the available tools rely on the lower level tools to properly work and are presented here in decreasing complexity level.
It is important to understand that the higher level package management tools such as aptitude or dselect rely on apt which, itself, relies on dpkg to manage the packages in the system.
See the APT HOWTO for more information about the Debian package management utilities. This document is available in various languages and formats, see the APT HOWTO entry on the DDP Users' Manuals overview.

dpkg
This is the main package management program. dpkg can be invoked with many options. Some common uses are:
Find out all the options: dpkg --help.

Print out the control file (and other information) for a specified package: dpkg --info foo_VVV-RRR.deb

Install a package (including unpacking and configuring) onto the file system of the hard disk: dpkg --install foo_VVV-RRR.deb.

Unpack (but do not configure) a Debian archive into the file system of the hard disk: dpkg --unpack foo_VVV-RRR.deb. Note that this operation does not necessarily leave the package in a usable state; some files may need further customization to run properly. This command removes any already-installed version of the program and runs the preinst (see What is a Debian preinst, postinst, prerm, and postrm script?, Section 7.6) script associated with the package.

Configure a package that already has been unpacked: dpkg --configure foo. Among other things, this action runs the postinst (see What is a Debian preinst, postinst, prerm, and postrm script?, Section 7.6) script associated with the package. It also updates the files listed in the conffiles for this package. Notice that the 'configure' operation takes as its argument a package name (e.g., foo), not the name of a Debian archive file (e.g., foo_VVV-RRR.deb).

Extract a single file named "blurf" (or a group of files named "blurf*" from a Debian archive: dpkg --fsys-tarfile foo_VVV-RRR.deb | tar -xf - blurf*

APT
APT is the Advanced Package Tool and provides the apt-get program. apt-get provides a simple way to retrieve and install packages from multiple sources using the command line. Unlike dpkg, apt-get does not understand .deb files, it works with the packages proper name and can only install .deb archives from a source specified in /etc/apt/sources.list. apt-get will call dpkg directly after downloading the .deb archives from the configured sources.
Some common ways to use apt-get are:
To update the list of package known by your system, you can run: apt-get update

(you should execute this regularly to update your package lists)

To upgrade all the packages on your system (without installing extra packages or removing packages), run: apt-get upgrade

To install the foo package and all its dependencies, run: apt-get install foo

To upgrade all the packages on your system, and, if needed for a package upgrade, installing extra packages or removing packages, run: apt-get dist-upgrade

(The command upgrade keeps a package at its installed obsolete version if upgrading would need an extra package to be installed, for a new dependency to be satisfied. The dist-upgrade command is less conservative.)

Note that you must be logged in as root to perform any commands that modify the system packages.
The apt tool suite also includes the apt-cache tool to query the package lists. You can use it to find packages providing specific functionality through simple text or regular expression queries and through queries of dependencies in the package management system. Some common ways to use apt-cache are:
To find packages whose description contain word: apt-cache search word

To print the detailed information of a package: apt-cache show package

To print the packages a given package depends on: apt-cache depends package

To print detailed information of the versions available for a package and the packages that reverse-depends on it: apt-cache showpkg package

For more information, install the apt package and read apt-get(8), sources.list(5) and install the apt-doc package and read /usr/share/doc/apt-doc/guide.html/index.html.

aptitude
aptitude is a package manager for Debian GNU/Linux systems that provides a frontend to the apt package management infrastructure. aptitude is a text-based interface using the curses library, it can be used to perform management tasks in a fast and easy way.
aptitude provides the functionality of dselect and apt-get, as well as many additional features not found in either program:
aptitude offers access to all versions of a package.

aptitude logs all its actions in /var/log/aptitude.

aptitude makes it easy to keep track of obsolete software by listing it under "Obsolete and Locally Created Packages".

aptitude includes a fairly powerful system for searching particular packages and limiting the package display. Users familiar with mutt will pick up quickly, as mutt was the inspiration for the expression syntax.

aptitude tracks which packages have been installed due to dependencies and removes them automatically when the packages that needed them are removed from the system.

aptitude can automatically install Recommended: packages[6].

aptitude can be used to install the predefined tasks available.

aptitude in full screen mode has su functionality embedded and can be run by a normal user. It will call su (and ask for the root password, if any) when you really need administrative privileges

You can use aptitude through a visual interface (simply run aptitude) or directly from the command line. The command line syntax used is very similar to the one used in apt-get. For example, to install the foo package, you can run aptitude install foo.
Note that aptitude is the preferred program for package management from console both for package installations and package or system upgrades.
For more informations, read the manual page aptitude(8) and install the aptitude-doc package.