Merge pull request #4644 from GitFuture/master

Translated a article
This commit is contained in:
VicYu 2016-11-12 16:31:38 +08:00 committed by GitHub
commit f4f4d627c4

View File

@ -1,20 +1,18 @@
Translating By GitFuture
# 用 dpkg 命令在 Debian 系的系统中管理软件包
# dpkg commands to manage packages on Debian Based Systems
[dpkg][7] 表示 Debian package manager (dpkg), Debian 软件包管理。dpkg 是一个可以安装、构建、删除及管理 Debian 软件包的命令行工具。dpkg 将 Aptitude主要并且用户友好的作为执行所有操作的前端。
[dpkg][7] stands for Debian package manager (dpkg). dpkg is a command-line tool to install, build, remove and manage Debian packages. dpkg uses Aptitude (primary and more user-friendly) as a front-end to perform all the actions.
dpkg 被 dpkg-deb 和 dpkg-query 等工具作为执行操作的前端。
Other utility such as dpkg-deb and dpkg-query uses dpkg as a front-end to perform some action.
现在大多数系统管理员使用 Apt[Apt-Get][6] 及 Aptitude 等工具,不用维护就可以轻松地管理软件。
Now a days most of the administrator using Apt, [Apt-Get][6] & Aptitude to manage packages easily without headache and its robust management too.
尽管如此,必要的时候还是需要用 dpkg 来安装某些软件。在 Linux 系统上广泛使用的包管理工具有 [yum][5], [dnf][4], [apt-get][3], dpkg, [rpm][2], [Zypper][1], pacman, urpmi 等等。
Even though still we need to use dpkg to perform some software installation where its necessary. Some other package manger utilities which are being used widely in Linux are [yum][5], [dnf][4], [apt-get][3], dpkg, [rpm][2], [Zypper][1], pacman, urpmi, etc.,
现在,我要在装有 Ubuntu 15.10 的机器上用一些实例讲解最常用的 dpkg 命令。
Now, im going to play on our Ubuntu 15.10 box to explain and cover mostly used dpkg commands with examples.
### 1) dpkg 常见命令的语法及 dpkg 文件位置
#### 1) Common syntax/file location for dpkg
See below for common syntax/ file location of dpkg which will help you if you want to check more about it.
下面是 dpkg 常见命令的语法及 dpkg 文件的位置,如果想深入了解,对你肯定大有益处。
<iframe marginwidth="0" marginheight="0" scrolling="no" frameborder="0" height="90" width="728" id="_mN_gpt_827143833" style="border-width: 0px; border-style: initial; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline;"></iframe>
```
@ -34,9 +32,9 @@ $ /var/lib/dpkg/status
```
#### 2) Install/Upgrade the package
### 2) 安装/升级软件
Use the below command to install/upgrade .deb packge on Debian based systems such as Debian, Mint, Ubuntu & elementryOS, etc..,. Here im going to install Atom through atom-amd64.deb file. It will upgrade if its installed other wise install a fresh one.
在基于 Debian 的系统里,比如 Debian Mint Ubuntu 和 elementryOS用以下命令来安装/升级 .deb 软件包。这里我要用 atom-amd64.deb 文件安装 Atom。要是已经安装了 Atom就会升级它。要么就会安装一个新的 Atom。
```
[Install/Upgrade dpkg packages]
@ -54,9 +52,9 @@ Processing triggers for mime-support (3.58ubuntu1) ...
```
#### 3) Install a package from folder
### 3) 从文件夹里安装软件
Use the below command to install the packages recursively from directory on Debian based systems such as Debian, Mint, Ubuntu & elementryOS, etc,. This will install all the *.deb packages under the /opt/software directory.
在基于 Debian 的系统中,用下列命令从目录下递归的安装软件。这会安装 /opt/software 目录下的所有以 .deb 为后缀的软件。
```
$ sudo dpkg -iR /opt/software
@ -72,9 +70,9 @@ Processing triggers for desktop-file-utils (0.22-1ubuntu3) ...
Processing triggers for mime-support (3.58ubuntu1) ...
```
#### 4) Print the Installed packages list
### 4) 显示已安装软件列表
Use the below command to List all installed packages, along with package version and description on Debian based systems such as Debian, Mint, Ubuntu & elementryOS, etc..,.
以下命令可以列出 Debian 系的系统中所有已安装的软件,同时会显示软件版本和描述信息。
```
$ dpkg -l
@ -94,9 +92,9 @@ ii account-plugin-salut 3.12.10-0ubuntu2 amd64
```
#### 5) Check particular Installed package
### 5) 查看指定的已安装软件
Use the below command to List individual installed package, along with package version and description on Debian based systems such as Debian, Mint, Ubuntu & elementryOS, etc..,.
用以下命令列出指定的一个已安装软件,同时会显示软件版本和描述信息。
<iframe marginwidth="0" marginheight="0" scrolling="no" frameborder="0" height="90" width="728" id="_mN_gpt_827143833" style="border-width: 0px; border-style: initial; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline;"></iframe>
```
@ -110,9 +108,9 @@ ii atom 1.5.3 amd64 A hackable text editor for the 21st
```
#### 6) Check package Installed Location
### 6) 查看软件安装目录
Use the below command to Check package Installed Location on Debian based systems such as Debian, Mint, Ubuntu & elementryOS, etc..,.
以下命令可以在基于 Debian 的系统上查看软件的安装路径。
```
$ dpkg -L atom
@ -130,9 +128,9 @@ $ dpkg -L atom
```
#### 7) View deb package content
### 7) 查看 deb 包内容
Use the below command to View deb package content, It will show list of files on inside .deb package.
下列命令可以查看 deb 包内容。它会显示 .deb 包中的一系列文件。
```
$ dpkg -c atom-amd64.deb
@ -151,9 +149,9 @@ drwxr-xr-x root/root 0 2016-02-13 02:13 ./usr/share/doc/
.
```
#### 8) Display details about package
### 8) 显示软件的详细信息
Use the below command to Display detailed information about package, package group, version, maintainer, Architecture, display depends packages, description, etc.,.
以下命令可以显示软件的详细信息,如软件名,软件类别,版本,维护者,软件架构,依赖的软件,软件描述等等。
```
$ dpkg -s atom
@ -171,9 +169,9 @@ Description: A hackable text editor for the 21st Century.
Atom is a free and open source text editor that is modern, approachable, and hackable to the core.</atom@github.com>
```
#### 9) Find what package owns the file
### 9) 查看文件属于哪个软件
Use the below command to find out what package does file belong.
用以下命令来查看文件属于哪个软件。
```
$ dpkg -S /usr/bin/atom
@ -181,9 +179,9 @@ atom: /usr/bin/atom
```
#### 10) Remove/Delete package
### 10) 移除/删除软件
Use the below command to Remove/Delete an installed package except configuration files.
以下命令可以用来移除/删除一个已经安装的软件,但不删除配置文件。
<iframe marginwidth="0" marginheight="0" scrolling="no" frameborder="0" height="90" width="728" id="_mN_gpt_827143833" style="border-width: 0px; border-style: initial; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline;"></iframe>
```
@ -198,9 +196,9 @@ Processing triggers for mime-support (3.58ubuntu1) ...
```
#### 11) Purge package
### 11) 清除软件
Use the below command to Remove/Delete everything including configuration files.
以下命令可以用来移除/删除包括配置文件在内的所有文件。
```
$ sudo dpkg -P atom
@ -214,9 +212,9 @@ Processing triggers for mime-support (3.58ubuntu1) ...
```
#### 12) Read more about dpkg
### 12) 了解更多
Use the below commands to read more about dpkg command information.
用以下命令来查看更多关于 dpkg 的信息。
```
$ dpkg -help
@ -225,7 +223,7 @@ $ man dpkg
```
Enjoy….)
开始体验 dpkg 吧。
--------------------------------------------------------------------------------
@ -233,7 +231,7 @@ via: http://www.2daygeek.com/dpkg-command-examples/
作者:[MAGESH MARUTHAMUTHU ][a]
译者:[译者ID](https://github.com/译者ID)
译者:[GitFuture](https://github.com/GitFuture)
校对:[校对者ID](https://github.com/校对者ID)