我用 LinuxLinux学习之路Linux

Debian 软件包的配置管理

2016-08-22  本文已影响602人  mst7

tl,dr

0. debconf

debconf是Debian系Linux系统软件包配置管理系统,下属多个命令工具。它与dpkg(Debian包管理系统)紧密集成,debconf负责包的配置管理,dpkg负责包的安装。

debconf下属命令集:

ray@ray-ThinkPad-X250:~$ debconf
debconf debconf-copydb debconf-set-selections
debconf-apt-progress debconf-escape debconf-show
debconf-communicate debconf-gettextize debconf-updatepo

参考自Wikipeadia:debconf (software package)

1. 重新配置软件包:dpkg-reconfigure

Reference:dpkg-reconfigure man page

功能介绍(来自于该命令的man page)


NAME
dpkg-reconfigure - reconfigure an already installed package
SYNOPSIS
dpkg-reconfigure [options] packages
DESCRIPTION
dpkg-reconfigure reconfigures packages after they have already been installed. Pass it the names of a package or packages to reconfigure. It will ask configuration questions, much like when the package was first installed. If you just want to see the current configuration of a package, see debconf-show(1) instead.


实例1:重新配置locales

$ sudo dpkg-reconfigure locales

实例2:重新配置Display Manager的选择(lightdm or gdm)

$ sudo dpkg-reconfigure lightdm
or
$ sudo dpkg-reconfigure gdm

实例3:重新配置整个系统(一般用户大故障恢复)

dpkg --configure -a will configure all unpacked but unconfigured packages.
dpkg-reconfigure -phigh -a will reconfigure all installed packages that use debconf with high priority.

2. 查看软件包的配置:debconf-show

Reference: debconf-show

功能介绍(来自于该命令的man page)


NAME
debconf-show - query the debconf database
SYNOPSIS
debconf-show packagename [...] [--db=dbname] debconf-show --listowners [--db=dbname] debconf-show --listdbs
DESCRIPTION
debconf-show lets you query the debconf database in different ways. The most common use is "debconf-show packagename", which displays all items in the debconf database owned by a given package, and their current values. Questions that have been asked already are prefixed with an '*'. This can be useful as a debugging aid, and especially handy in bug reports involving a package's use of debconf.


一般建议在使用上一章节命令dpkg-reconfigure修改配置先,先通过这个命令查看、备份一下配置。

实例1:查看locales配置

ray@ray-ThinkPad-X250:~$ sudo debconf-show locales
locales/default_environment_locale: en_US.UTF-8
locales/locales_to_be_generated: , en_US.UTF-8 UTF-8, zh_CN.UTF-8 UTF-8
ray@ray-ThinkPad-X250:~$

实例2:查看Display Manager配置

ray@ray-ThinkPad-X250:~$ sudo debconf-show lightdm
lightdm/daemon_name: /usr/sbin/lightdm
* shared/default-x-display-manager: lightdm
ray@ray-ThinkPad-X250:~$

3. dpkg 包管理

dpkg 可以实现包的增删改调
dpkg -l 列出所有安装的包及其状态,可以使用grep过滤显示结果。常见的数据包状态有:

iU 表示软件包未安装成功
ii 表示安装成功
rc 表示软件包已经被卸载,但配置文件仍在

其中 rc 状态的包即卸载了包却保留了配置文件。如果想要完整删除所有 rc 状态的包一个一个删还是很麻烦的,所以可以使用以下命令进行清理:

dpkg -l | grep ^rc | cut -d' ' -f3 | sudo xargs dpkg --purge

参考URL:
http://blog.csdn.net/chrisniu1984/article/details/6619755
http://www.th7.cn/system/lin/201604/160329.shtml

参考URL

重要文件 Updating packages with dpkg-reconfigure---Debian's Secret Recovery Tool
Debian Wiki ChangeLanguage
What is dpkg-reconfigure and how is it different from dpkg --configure?

上一篇 下一篇

猜你喜欢

热点阅读