[LHR]: package を管理する (dpkg)

<Home> → <LHR> → <[LHR]: package を管理する (dpkg)>

はじめに

dpkg は、Debian で使用されているパッケージ管理の一つです。

dpkg を使用することで、簡単に直接 Binary (or source) から Install/Uninstall/Upgrade が可能になります。ソフトウェアをパッケージと言う単位で管理し、それらが依存している他のソフトウェアの確認等の管理も行っています。Debian 系の Distributor の殆どはこの dpkg を使用してシステムを構築しています。

dpkg のフロントエンドとして dselect が用意されていますが、同様の機能を備えた <APT> の方が人気があるようです。

deb ファイルは、以下の規則に習って命名されています。

<package 名>-<version 番号>-<Release 番号>_<architecture>.deb

例えば「bash_2.05a-11_i386.deb」と言うファイル名の場合は以下の通りになります。


使用例1

Knoppix(hd installed) では何故か [GNU time(GNU)] が Install されていません。そこで dpkg コマンドにて GNU Time の Install/Uninstall を例に話を進めて行きます。package は [Package: time(Debian Packages)] より入手しました。

package ファイルを確認します (--info, -I)

ダウンロードしてきた package の中身を確認します。--info <file 名> を使用します。

# dpkg --info time_1.7-16_i386.deb
新形式 debian パッケージ、バージョン 2.0。
サイズ 30374 バイト: コントロールアーカイブ = 1656 バイト。
804 バイト, 20 行 control
495 バイト, 8 行 md5sums
843 バイト, 36 行 * postinst #!/bin/sh
792 バイト, 37 行 * preinst #!/bin/sh
750 バイト, 36 行 * prerm #!/bin/sh
Package: time
Version: 1.7-16
Section: utils
Priority: standard
Architecture: i386
Depends: libc6 (>= 2.3.1-1)
Installed-Size: 132
Maintainer: Dirk Eddelbuettel <edd@debian.org>
Description: The GNU time command.
The `time' command runs another program, then displays information
about the resources used by that program, collected by the system while
the program was running. You can select which information is reported
and the format in which it is shown, or have `time' save the information
in a file instead of display it on the screen.
.
The resources that `time' can report on fall into the general
categories of time, memory, I/O, and IPC calls.
.
The GNU version can format the output in arbitrary ways by using a
printf-style format string to include various resource measurements.

package を Install します (--install, -i)

--install <file 名> を使用します。

-G(--refuse-downgrade) パラメータと一緒に使用すると Install する package のバージョンが古い場合には Install が抑制されます。

# dpkg --install time_1.7-16_i386.deb
(データベースを読み込んでいます... 現在 96491 個のファイルとディレクトリがインストールされています。)
(time_1.7-16_i386.deb から) time を展開しています...
time (1.7-16) を設定しています ...

package の詳細情報を表示します (--status, -s)

--status <package 名> を使用します。

# dpkg --status time
Package: time
Status: install ok installed
Priority: standard
Section: utils
Installed-Size: 132
Maintainer: Dirk Eddelbuettel <edd@debian.org>
Version: 1.7-16
Depends: libc6 (>= 2.3.1-1)
Description: The GNU time command.
The `time' command runs another program, then displays information
about the resources used by that program, collected by the system while
the program was running. You can select which information is reported
and the format in which it is shown, or have `time' save the information
in a file instead of display it on the screen.
.
The resources that `time' can report on fall into the general
categories of time, memory, I/O, and IPC calls.
.
The GNU version can format the output in arbitrary ways by using a
printf-style format string to include various resource measurements.

package の一覧を表示します (--list, -l)

--list <package 名> を使用します。package 名を指定しない場合、Install されている全ての package 名が表示されます。

# dpkg --list time
要望=(U)不明/(I)インストール/(R)削除/(P)完全削除/(H)維持
| 状態=(N)無/(I)インストール済/(C)設定/(U)展開/(F)設定失敗/(H)半インストール
|/ エラー=(空欄)無/(H)維持/(R)要再インストール/X=両方(状態,エラーの大文字=異常)
||/ 名前           バージョン     説明
+++-==============-==============-============================================
ii  time           1.7-16         The GNU time command.

package 内のファイルを表示します (--listfiles, -L)

--listfiles <package 名> を使用します。

# dpkg --listfiles time
/.
/usr
/usr/share
/usr/share/info
/usr/share/info/time.info.gz
/usr/share/doc
/usr/share/doc/time
/usr/share/doc/time/time.html
/usr/share/doc/time/copyright
/usr/share/doc/time/changelog.gz
/usr/share/doc/time/changelog.Debian.gz
/usr/share/doc-base
/usr/share/doc-base/time
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/time.1.gz
/usr/bin
/usr/bin/time

package を Uninstall します (--remove, -r)

--remove <package 名> を使用します。

# dpkg --remove time
(データベースを読み込んでいます... 現在 96499 個のファイルとディレクトリがインストールされています。)
time を削除しています...
Document `time' is not installed, cannot remove.

使用例2

Install されているファイル名を検索します (--search, -S)

例では Install されている package に「Bluetooth」というファイル名があるか検索しています。どうやら、Linux Kernel (kernel-image-2.4.21-xfs) 以外に係わっていそうな package は Install されていないようです。

# dpkg -S bluetooth
kernel-image-2.4.21-xfs: /lib/modules/2.4.21-xfs/kernel/drivers/bluetooth/hci_usb.o
kernel-image-2.4.21-xfs: /lib/modules/2.4.21-xfs/kernel/net/bluetooth/rfcomm/rfcomm.o
kernel-image-2.4.21-xfs: /lib/modules/2.4.21-xfs/kernel/drivers/bluetooth/bt3c_cs.o
kernel-image-2.4.21-xfs: /lib/modules/2.4.21-xfs/kernel/net/bluetooth
kernel-image-2.4.21-xfs: /lib/modules/2.4.21-xfs/kernel/net/bluetooth/bnep/bnep.o
kernel-image-2.4.21-xfs: /lib/modules/2.4.21-xfs/kernel/net/bluetooth/sco.o
kernel-image-2.4.21-xfs: /lib/modules/2.4.21-xfs/kernel/net/bluetooth/l2cap.o
kernel-image-2.4.21-xfs: /lib/modules/2.4.21-xfs/kernel/net/bluetooth/bnep
kernel-image-2.4.21-xfs: /lib/modules/2.4.21-xfs/kernel/drivers/bluetooth/bluecard_cs.o
kernel-image-2.4.21-xfs: /lib/modules/2.4.21-xfs/kernel/drivers/bluetooth/hci_uart.o
kernel-image-2.4.21-xfs: /lib/modules/2.4.21-xfs/kernel/net/bluetooth/rfcomm
kernel-image-2.4.21-xfs: /lib/modules/2.4.21-xfs/kernel/drivers/bluetooth/hci_vhci.o
kernel-image-2.4.21-xfs: /lib/modules/2.4.21-xfs/kernel/drivers/bluetooth
kernel-image-2.4.21-xfs: /lib/modules/2.4.21-xfs/kernel/drivers/bluetooth/dtl1_cs.o
kernel-image-2.4.21-xfs: /lib/modules/2.4.21-xfs/kernel/net/bluetooth/bluez.o
kernel-image-2.4.21-xfs: /lib/modules/2.4.21-xfs/kernel/drivers/bluetooth/btuart_cs.o

Resource

お勧め

使用例

参考情報


<Home> → <LHR> → <[LHR]: package を管理する (dpkg)>
Copyright (c) 2003 Makoto NARA (Mc.N), All rights reserved.
<Terms of Use>

Valid CSS! Valid HTML 4.01!