Dpkg command Overview

Source: Internet
Author: User

First, we need to learn about Debian's middle-layer package management dpkg, which is a foundation.
Introduction
Dpkg is the Debian intermediate Software Package Manager, similar to rpm.
Dpkg is the mainstay of the Debian software package management system. It is responsible for safely uninstalling, configuring, and maintaining installed software packages. it is also the backend of many software package management tools in the Debian system. for more information about dpkg, see: http://www.dpkg.org

All packages in the system are stored in the/var/lib/dpkg/directory. The subdirectory "/var/lib/dpkg/INFO" is used to save the configuration file list of each software package.
. Conffiles records the configuration file list of the software package.

. List stores the file list in the software package. You can find the specific installation location of the file in the software package from the. list information.

. Md5sums records the MD5 information of the software package. This information is used for package verification.

The. prerm script runs before the Debian report package. The main function is to stop the service acting on the package to be upgraded until the package is installed or upgraded.

The. postinst script is used to complete the configuration after the Debian package is unbundled. It is usually used to execute commands related to the Installed Package and restart the service.

The/var/lib/dpkg/available file contains the description of the software package, which includes all the software packages in the Debian installation source used by the current system, these include installed and uninstalled software packages in the current system.

Dpkg

Query Information for Installation
Query all Deb packages installed in the current system
The dpkg-l command is used to query information about all Deb packages installed in the current system. You can perform more complex queries through less and grep.

For example, find the vim-related software package, dpkg-L | grep-ivim
(If IU is found, the software package is not successfully installed, and II indicates that the installation is successful)

View Details of installed software packages

Run the dpkg-s command to view the details of the software package, including the version and dependency.

File installed by the software package installed in the query system

The dpkg-l command is used to query the installation files of the software packages installed in the system and the installation files.

TIPS: How can I check where the software is packaged?
Use apt-Get install *

How can we see where the software is packaged?
Dpkg-l package-name | more

Which package does a file belong to in the query system?
The dpkg-s command is used to understand which package the current software belongs.

Query uninstalled Information
Query details of uninstalled software packages
The dpkg-I command is used to view the details of a software package that is not installed, so that you can see whether the software package needs to be installed.

Query the files contained in the Deb package file

Dpkg-C displays the list of files not installed with the Deb package, and the installation location

Install software package

Dpkg-I manually install the Deb package to the system, but sometimes there is a dpends relationship. We recommend that you use apt-get to install it.

If the software is not successfully installed due to the relationship between dpends and dpkg-I, you can use apt-get-F install to solve the problem.

Solve the Problem of dpends when dpkg-I installs the Deb package

Apt-get-F install solves the dpends problem.

Example: dpkg-I lftp_3.1.3-1_i386.deb

Selecting previusly deselected package lftp.

(Reading database... 20654 files and directories currently installed .)
Unpacking lftp (from lftp_3.1.3-1_i386.deb )...
Dpkg: dependency problems prevent configuration of lftp:
Lftp depends on libexpat1 (<= 1.95.8); however
Dpkg: Error Processing lftp (-- install)
Dependency problems-leaving unconfigured
Errors were encountered while processing:
Lftp
// Lftp package installation failed

Dpkg-L | grep lftp
IU lftp 3.1.3-1 sophisticated
Command-line FTP/HTTP client P

// "Dpkg-L" indicates that the lftp package is not successfully installed.

(IU indicates that the installation is not successful, II indicates that the installation is successful)

Use apt-get-F install

Uninstall Deb package
Dpkg-R is used to uninstall a specified software package. This command only uninstalls the software package and installs it in the system, instead of deleting the configuration file of the software package. however, the software package is stored in the system and can be provided for later use when installing the software package.
For example, dpkg-r prozilla is removed and then viewed with dpkg-L | grep prozilla.
The RC proc 1.3.6-3woody3 multi-thraded Download Accelerator is displayed.
Indicates that the package has been uninstalled, but the configuration file is still in the "RC" Table configuration file.

Uninstall the software package and clear the configuration file
Dpkg-P is used to uninstall the software package and delete the configuration file. dpkg-P cannot solve the dpends problem. We recommend that you use the apt-Get operation when uninstalling the software package.

Reconfigure the Software Package
For many software packages (especially system and server software packages) in the Debian system, a dialog box is displayed when the software package is installed for the first time, prompting you to enter necessary configuration information. when you need to configure the software package again, you can use dpkg-reconfigure to configure the specified software package.
For example, dpkg-reconfigure locales

Configuration language

Alien package Conversion Tool

If we have a favorite RPM package but no Deb version.
What should I do ~?
It can be converted or directly installed through alien. This little guy is very convenient!

The basic commands are as follows:
First install alien through apt-Get install.
Then
Alien-I name-of-the-pakage.rpm/* for direct installation of RPM packages
Alien-D, -- to-DEB/* Make Debian packages, This is the default
Example: alien-D package. rpm
Alien-R, -- to-RPM/* Make RPM packages

Example: alien-r package. Deb
Alien-P, -- to-PKG/* make Solaris PKG packages
Alien -- to-SLP/* Make SLP packages
Alien-T, -- to-tgz/* Make tgz packages
Alien-T Detection
Alien -- patch = patch

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.