Search the Catalog
Learning Debian GNU/Linux

Learning Debian GNU/Linux

By Bill McCarty
1st Edition September 1999
1-56592-705-2, Order Number: 7052
360 pages, $34.95 , Includes CD-ROM

Previous: C.2 The Package Management Tools Appendix C
The Debian Package Management Utilities
Next: C.4 Using dselect
 

C.3 Using dpkg

You might think that dpkg has been superseded by the more recent package management tools, dselect and apt-get, which stress ease of use. However, dpkg remains a good choice for performing several common package management tasks.

C.3.1 Installing a Package

If you have a package file containing a package you want to install, the simplest way to install the package is to use the dpkg command:

dpkg --install 
packagefile

where packagefile stands for the name of the package file, which generally ends with the characters .deb. If all the prerequisite packages have already been installed and if the package does not conflict with any installed packages, the command will unpack the package files, move them to their proper locations, and execute the scripts necessary to configure the package.

If your system lacks a prerequisite package or if the specified package conflicts with a package installed on your system, dpkg will report the error and terminate. If the problem is the lack of one or more prerequisite packages, you can obtain and install them, and then install the desired package. If the problem is a package conflict, you must decide which of the conflicting packages you want. If you decide to remove an installed package, you can do so using the technique described in the following subsection.

C.3.2 Removing a Package

To remove an installed package, use the command

dpkg --remove 
package

This command does not remove package configuration files, which may facilitate subsequent re-installation of the package. If you want to remove the configuration files as well, use the command:

dpkg --purge 
package

C.3.3 Querying the Package Database

The Debian package management facility maintains a database that contains information about installed packages. You can use the dpkg command to query this database.

C.3.3.1 Printing the description of a package

To print the description of a package, issue the following command:

dpkg --print-avail 
package

where package specifies the name of the package. For example, to print the description of the package gnome-guile, issue the command:

dpkg --print-avail gnome-guile 

C.3.3.2 List packages by name

To list known packages by name, issue the following command:

dpkg -l 
pattern

where pattern is a single-quoted string that specifies a pattern. Only packages with names matching the pattern will be listed. The pattern can include wildcards characters such as an asterisk (*), which substitutes for any string of characters. For example, the pattern 'apache*' matches package names beginning with apache.

The listing presents the following information:

Selection status

Indicates the selection status established using dselect, which may be any one of:

Unknown

Indicates that the selection status is not known.

Install

Indicates that the package is marked for installation.

Remove

Indicates that the package is marked for removal.

Purge

Indicates that the package and its configuration files are marked for removal.

Status

Indicates the installation status of the package, which may be any one of:

Not installed

Indicates that the package has not been installed.

Installed

Indicates that the package has been successfully installed.

Config-files

Indicates that only the package's configuration files are currently installed.

Unpacked

Indicates that the package has been unpacked, in preparation for installation.

Failed-config

Indicates that the package has been installed, but its configuration script failed.

Half-installed

Indicates that an attempt to install the package failed.

Error

Indicates the error status of the package, which may be one or more of:

None

Indicates no error is associated with the package.

Hold

Indicates that the package has been placed on hold, so that it can be neither installed nor removed.

Reinstallation required

Indicates that the package must be re-installed.

Name

Gives the name of the package.

Version

Gives the version number of the package.

Description

Gives a brief description of the package. Descriptions are generally available only for installed packages.

If the command produces too much output to conveniently view, pipe its result through the more command, which lets you page through the output:

dpkg -l 
pattern | more

If you want to view only installed packages, issue a command such as:

dpkg -l 
pattern | grep '^i' | more

For example, to view installed packages with names beginning with gnome, issue the following command:

dpkg -l 'gnome*' | grep '^i' | more

The pattern '*' matches any package name, so the following command prints information about every installed package:

dpkg -l '*' | grep '^i' | more

C.3.3.3 Report status of a package

To report the status of a package, issue the following command:

dpkg --status 
package

where package specifies the name of the package.

For example, to report the status of the gnome-guile package, issue the command:

dpkg --status gnome-guile

C.3.3.4 List files installed from a package

To list the files installed from a specified package, issue the command:

dpkg --listfiles 
package

where package specifies the name of the package.

For example, to list the files installed from the gnome-guile package, issue the command:

dpkg --listfiles gnome-guile

Previous: C.2 The Package Management Tools Learning Debian GNU/Linux Next: C.4 Using dselect
C.2 The Package Management Tools Book Index C.4 Using dselect

Back to: Learning Debian GNU/Linux


O'Reilly Home | O'Reilly Bookstores | How to Order | O'Reilly Contacts
International | About O'Reilly | Affiliated Companies

© 1999, O'Reilly & Associates, Inc.


HIVE: All information for read only. Please respect copyright!
Hosted by hive КГБ: Киевская городская библиотека