These classnotes are depreciated. As of 2005, I no longer teach the classes. Notes will remain online for legacy purposes

UNIX02/Debian Management

Classnotes | UNIX02 | RecentChanges | Preferences

.debs to dpkg

Recall that the fundimental unit in an RPM-based system is the RPM file. The RPM is a compressed package containing installation, uninstallation and dependency information as well as all executables, configurations and documentation for a given application. RPMs were manipulated using the rpm program.

Debian based systems have a similar fundimental unit from which they are constructed called deb. All Debian applications are distributed as debs.

This is actually one of the big blocking points for Debian being an LSB-compliant Linux OS, as the LSB requires the system use RPMs as its base. Many Debian enthusiasts feel that this is an unfair requirement and was motivated by the fact that the LSB was funded in large part by various RPM-distro vendors. For more info on LSB, see

The two fundimental tools for manipulating debs are dpkg-deb and dpkg (which actually provides a mid-level interface to dpkg-deb). These tools together are roughly equivalent to an RPM-based distro's rpm, however, in a functioning Debian system you will almost never need to use them. (Though you may on rare occassion need to use them to install problematic debs, especially those from unofficial sources. In those situations, refer to the associated man pages for more information.)

One of Debian's strengths is in its distributed mirror system. Here, the basic idea is that all official Debian debs are located in a central repository that is then mirrored all over the internet (providing fast local access to said debs). Provided you have a reasonable internet connection, you can then download debs as needed during application installs. Additionally, you can upgrade your entire OS over the internet. Various security checks including things like digital signatures prevent trojanned packages from creeping onto your server, and automated dependency trackers make installation of any application a breeze.

While you can use dpkg to install every deb on your system, there is a more advanced tool which will make your life much easier.

apt : Advanced Packaging Tool

Modern Debian distributions use a tool called 'apt' for package management. As we said all possible packages for install are stored in a matrix of mirrors on the internet. To install a package, you simply issue a command and Debian goes out, figures out the dependencies, and installs your package. If you are not connected to the internet (or have a slow connection) you can use other media (such as CDs or DVDs) as your package source.

The strength of this is that you can avoid the [dependency hell] that you usually find yourself in when using RPM-based distros (such as Red Hat). It is such a significant strength, that many people have attempted to port apt to RPM-based systems.


In order for apt to know where to obtain it's packages for install, you must edit a file which gives it a list of locations. That file is /etc/apt/sources.list. By default, this file normally will look something like this:

 # See sources.list(5) for more information, especialy
 # Remember that you can only use http, ftp or file URIs
 # CDROMs are managed through the apt-cdrom tool.
 deb stable main contrib non-free
 deb stable/non-US main contrib non-free
 deb stable/updates main contrib non-free

 # Uncomment if you want the apt-get source function to work
 #deb-src stable main contrib non-free
 #deb-src stable non-US

The first word on each line, deb or deb-src, indicates the type of archive: whether it contains binary packages (deb), that is, the pre-compiled packages that we normally use, or source packages (deb-src). If you install from Knoppix, your sources.list file will look substantially different. You can also specify locations on your local machine (for example, on a CD-ROM) thusly:

 deb file:/mnt/cdrom0 debs/

I have included the sources.list file from my Debian boxes I set up in Tucson. This file includes a local mirror here at the U of A. You can find this file [here].

apt-get install

The common way to install a new package, or upgrade an existing one, is to use the apt-get command. The command has many options (see the man page for apt-get), but if all you wish to do is install some package 'foobar' you would use this:

 $ apt-get install foobar

apt would first determine if there were any unmet dependencies, then it would display those dependencies and prompt you is you wish to proceed. If you select 'yes', apt-get will download and install all necessary packages.

As a concrete example, if I wanted to install 'slash' (which is a dynamic web-page content generator made famous by [Slashdot]) my dialog may look something like this:

 root@rygel:/# apt-get install slash    
 Reading Package Lists... Done
 Building Dependency Tree... Done
 The following extra packages will be installed:
   apache-common apache-dev libapache-dbi-perl
   libapache-dbilogger-perl libapache-mod-perl
   libapache-request-perl libappconfig-perl
   libcompress-zlib-perl libdb4.1-dev libdbix-password-perl
   libdevel-symdump-perl libemail-valid-perl
   libhtml-format-perl libimage-size-perl
 The following NEW packages will be installed:
   apache-dev libapache-dbi-perl libapache-dbilogger-perl
   libapache-mod-perl libapache-request-perl
   libtimedate-perl libxml-rss-perl slash
 1 packages upgraded, 21 newly installed, 0 to remove and 531 not upgraded.
 Need to get 9993kB of archives. After unpacking 29.5MB will be used.
 Do you want to continue? [Y/n] 

apt-get can also intelligently upgrade your entire system, which is perhaps its biggest strength. By issuing

 $ apt-get dist-upgrade

apt-get will find all newer versions of the packages on your machine and upgrade them all. It works very well, and rarely makes mistakes (i.e., you truely can trust it). This can make system maintenance under Debian a breeze (and is why so many experienced Linux users love Debian).

For more information on apt, see the APT-HOWTO here:


Another tool which a lot of traditional Debian users like is dselect. dselect is a menu based install and upgrade program for the deb packages. It looks somewhat like this:

I will not be covering dselect in this class. Many persons new to Debian find dselect confusing, and since apt functions perfectly well we do not really need it. If you would like more information on dselect, see it's man page or pages 733-742 of the book.

Classnotes | UNIX02 | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited September 13, 2003 1:44 am (diff)
(C) Copyright 2003 Samuel Hart
Creative Commons License
This work is licensed under a Creative Commons License.