LPI Linux Certification/Use Debian Package Management

Detailed Objective
(LPIC-1 Version 5.0

Weight: 3

Description: Candidates should be able to perform package management using the Debian package tools.

Key knowledge areas:
 * Install, upgrade and uninstall Debian binary packages.
 * Find packages containing specific files or libraries which may or may not be installed.
 * Obtain package information like version, content, dependencies, package integrity and installation status (whether or not the package is installed).
 * Awareness of.

The following is a partial list of the used files, terms and utilities:

Package Structure
In order to understand how to use Debian's package management system, it would be useful to first have an understanding of how a Debian package is named. For example, the package ncftp_3.1.3-1_i386.deb has 5 major parts: Note that there is special significance to the use of underscores(_) and hyphens(-); an underscore shall separate the name of the program and its version, a hyphen shall separate a version number and the revision number, and an underscore shall separate the revision number and the architecture.
 * ncftp - the name of the program/application/library
 * 3.1.3 - the version of the program/application/library assigned by the original (upstream) author(s)
 * 1 - the revision number of the package assigned by the person(s) who packaged the program for a Debian system
 * i386 - the architecture the packaged program is designed to run on
 * .deb - signifies this is a Debian package

dpkg
dpkg is the "grandaddy" or "back-end" of the Debian Package Management System. Features present in the more advanced tools are not available to dpkg but it is nevertheless a useful tool.

Some notes:


 * dpkg keeps its record of available packages in /var/lib/dpkg/available.

Some of the more common functions used by administrators by dpkg are:

Adding, Removing, and Configuring Packages
 * dpkg {-i|--install}  will install the specified package
 * dpkg {-r|--remove}  will remove the specified package (but leave the configuration files intact)
 * <tt>dpkg {-P|--purge} <package-name></tt> will remove the specified package and the corresponding configuration files
 * <tt>dpkg --root /target -i </tt> will install a package into a unbootable system by specifying the system root.
 * <tt>dpkg --unpack <package-name></tt> will unpack (but do not configure) a Debian archive into the file system of the hard disk
 * <tt>dpkg --configure <package-name></tt> will configure a package that already has been unpacked

<tt>Querying Package Information</tt>
 * <tt>dpkg --info <package-name></tt> will print out the control file (and other information) for a specified package
 * <tt>dpkg {-l|--list}</tt> this will give you a list of installed packages.
 * <tt>dpkg {-a|--pending}</tt> is given instead of a package name, then all packages unpacked, but marked to be removed or purged in file /var/lib/dpkg/status, are removed or purged, respectively.
 * <tt>dpkg -s (--status)</tt> <package-name> will give you a description of installed package

<tt>Updating Package Information</tt>
 * <tt>dpkg --update-avail <package-name></tt> will replace old information with with new information from package.
 * <tt>dpkg --merge-avail <package-name></tt> will combine old information with new information from package.

dpkg-reconfigure
<tt>dpkg-reconfigure</tt> reconfigures packages after they have already been installed.


 * <tt>dpkg-reconfigure <package-name></tt> to reconfigure the initial installation settings
 * <tt>dpkg-reconfigure --priority=medium package [...]</tt> will set the minimum priority of question that will be displayed
 * <tt>dpkg-reconfigure --all</tt> will reconfigure all packages
 * <tt>dpkg-reconfigure locales</tt> will generate any extra locales
 * <tt>dpkg-reconfigure --p=low</tt> xserver-xfree86 will reconfigure X server

Dselect
The utility that allows you on debian to easely add/remove packages is dselect.
 * Choose the access method to use.
 * Update list of available packages, if possible.
 * Request which packages you want on your system.
 * Install and upgrade wanted packages.
 * Configure any packages that are unconfigured.
 * Remove unwanted software.

There is on dselect an interactive menu that will allow you to install/remove packages. Care must be taken with this utility. You can damage your system.

Dselect menu example: Debian `dselect' package handling frontend.

0. [A]ccess   Choose the access method to use. 1. [U]pdate   Update list of available packages, if possible. 2. [S]elect   Request which packages you want on your system. 3. [I]nstall  Install and upgrade wanted packages. 4. [C]onfig   Configure any packages that are unconfigured. 5. [R]emove   Remove unwanted software. 6. [Q]uit     Quit dselect.

$ dselect - list of access methods Abbrev. Descriptio cdrom          Install from a CD-ROM. * multi_cd      Install from a CD-ROM set. nfs           Install from an NFS server (not yet mounted). multi_nfs     Install from an NFS server (using the CD-ROM set) (not yet mounted). harddisk      Install from a hard disk partition (not yet mounted). mounted       Install from a filesystem which is already mounted. multi_mount   Install from a mounted partition with changing contents. floppy        Install from a pile of floppy disks. apt           APT Acquisition [file,http,ftp]

apt-get
If you know the name of a package you want to install, use apt-get. You must configure the sources.list file. This same file is used when you choose the apt access method of dselect. The location is <tt>/etc/apt</tt>.


 * <tt>apt-get install <package-name></tt> will search its database for the most recent version of this package and will retrieve and install it from the corresponding archive as specified in sources.list. In the event that this package depends on another APT will check the dependencies and install the needed packages.
 * <tt>apt-get install &lt;package-name&gt;=&lt;version&gt;</tt> will install a package at the version specified
 * <tt>apt-get install &lt;package-name&gt; -o DPkg::options::="--force-overwrite"</tt> installs a package ignoring "error processing ..., which is also in package ..." errors.
 * <tt>apt-get remove <package-name></tt> will remove the specified package but keep its configuration files.
 * <tt>apt-get --purge remove <package-name></tt> will remove the specified package and its configuration files.
 * <tt>apt-get -u install &lt;package-name&gt;</tt> will upgrade and install a specific package.
 * <tt>apt-get -u upgrade</tt> will upgrade packages within the same distribution packages except those which have been kept back because of broken dependencies or new dependencies.
 * <tt>apt-get -u dist-upgrade</tt> will upgrade an entire Debian system at once.

apt-file

 * <tt>apt-file search <file-name></tt> will search for a package which includes the specified file.
 * <tt>apt-file list <package-name></tt> will list the contents of a package matching the pattern. This action is very close to the dpkg -S command except the package does not need to be installed or fetched.

Apt-cache
To find the name of a package that you want to install use apt-cache. apt-cache main options are :


 * add - Add a package file to the source cache
 * showpkg - Show some general information for a single package
 * stats - Show some basic statistics
 * search - Search the package list for a regex pattern
 * show - Show a readable record for the package
 * depends – Show raw dependency information for a package

user@host:~$ apt-cache search gimp babygimp - An icon editor in Perl-Tk blackbook - GTK+ Address Book Applet cupsys-driver-gimpprint - Gimp-Print printer drivers for CUPS escputil - A maintenance utility for Epson Stylus printers filmgimp - A motion picture editing and retouching tool

Resources
APT HOWTO http://www.debian.org/doc/manuals/apt-howto/index.en.html dselect Documentation for Beginners http://www.debian.org/doc/manuals/dselect-beginner/

Exercises

 * Exercises results


 * 1) Install a system with Debian.
 * 2) Get familiar with dselect and remove the tcpdump utility.
 * 3) Install back with apt-get the package that contains the tcpdump utility.
 * 4) Try kpackage to install ethereal