Installing software with Apt-get
APT (Advance Packaging Tool) is a wonderful package management system. It consists of different tools, which names usually begins with "apt-" : apt-get, apt-cache, apt-cdrom, etc. Unlike RPM, which equivalent in a Debian system would probably be DPKG, apt-get handles dependencies resolution and takes care of downloading the software for you (much like YUM in a Red Hat system).
Though apt-get is generally used to install binary packages, it also can build and install source packages (like Gentoo's emerge). One can further more ease the process of installing software by using Synaptic (Graphical Interface), which is considered more featured APT frontend.
aptitude is a terminal-based apt frontend with a number of useful features, including: a mutt-like syntax for matching packages in a flexible manner, dselect-like persistence of user actions, the ability to retrieve and display the Debian changelog of most packages, and a command-line mode similar to that of apt-get. One should use aptitude to install meta-packages because aptitude keeps log of all packages that are part of meta-package. Its easy to remove/un-install meta-package in one go with aptitude.
One must have root privileges to execute apt-get or aptitude commands. Execute 'su' in Debian and prefix 'sudo' in Ubuntu to gain root privileges.
apt-get depends on Debian packages repositories (where are stored both sources and binary packages) that can be configured in the file /etc/apt/sources.list. A typical Debian stable sources.list would look something like this :
Code:
#Local Mirror
deb ftp://ftp.us.debian.org/debian/ stable main contrib non-free
deb-src ftp://ftp.us.debian.org/debian/ stable main contrib non-free
#Security Updates
deb ftp://ftp.us.debian.org/debian-security/ stable/updates main contrib non-free
deb-src ftp://ftp.us.debian.org/debian-security/ stable/updates main contrib non-free
APT includes a tool called apt-setup, which can be summoned from the command line, to help you configure a proper /etc/apt/sources.list file, optimized for your needs and geographic location.
One can also configure APT to follow the testing or the unstable distribution of Debian.
Once the user has a sources.list adapted to his/her needs, the local list of packages needs to be updated :
Code:
apt-get update
Only then can the repositories be browsed with apt-cache.
To search a package from its text description :
Code:
apt-cache search
Replace with an application name or word. For example,
Code:
apt-cache search irc client
will display a list of several irc clients.
To know more about a package and its description (dependencies, functionnalities, maintainer's identity, etc.) :
Code:
apt-cache show
In this case you have to replace with the exact package name.
Installating a binary package is done in one single step :
Code:
apt-get install
Another neat feature of apt-get : it allows to build and install a source package. Minimally, two steps are needed in order to do that. First install the package dependencies :
Code:
apt-get build-dep
Secondly tell apt-get to build and install the package itself :
Code:
apt-get source -b
For example, installing the email client "pine" can be done like that :
Code:
apt-get build-dep pine
apt-get source -b pine
Uninstalling a package is done like this :
Code:
apt-get remove
Or if you wish to remove the package along with all of its configuration files (essentially doing a clean uninstall):
Code:
apt-get remove --purge
A word of caution : apt-get handles dependencies in a very strict manner. If you try to uninstall a piece of software that other pieces of software depends on, apt-get will also want to uninstall them (not before warning you about the situation).
Further reading : Debian Reference, Chapter 6 - Debian package management
For the impatient : Debian Quick Reference, Chapter 3 - Debian package management