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

Showing revision 1

apt : Advanced Packaging Tool

Modern Debian distributions use a tool called 'apt' for package management. The basic idea is that 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.

/etc/apt/sources.list

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 http://http.us.debian.org/debian stable main contrib non-free
 deb http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free
 deb http://security.debian.org stable/updates main contrib non-free

 # Uncomment if you want the apt-get source function to work
 #deb-src http://http.us.debian.org/debian stable main contrib non-free
 #deb-src http://non-us.debian.org/debian-non-US 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/

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: http://www.debian.org/doc/manuals/apt-howto/index.en.html


Classnotes | UNIX02 | RecentChanges | Preferences
This page is read-only | View other revisions | View current revision
Edited May 17, 2003 1:12 am (diff)
Search:
(C) Copyright 2003 Samuel Hart
Creative Commons License
This work is licensed under a Creative Commons License.