ウェブサイト検索

Debian ベースのディストリビューション用の「dpkg コマンド」の 15 の実践例


Debian GNU/LinuxKnoppix を含む多くの Linux ディストリビューションのマザーオペレーティング システムです。、KaliUbuntuMint などは、dpkgapt などのさまざまなパッケージ マネージャーを使用します適性シナプスタスクセル選択解除dpkg-deb > とdpkg-split

dpkg」 コマンドに焦点を当てる前に、これらのそれぞれについて簡単に説明します。

APTコマンド

Aptアドバンスト パッケージ ツールの略です。これは「deb」パッケージを処理せずに直接動作しますが、「/etc/apt/」で指定された場所にある「deb」アーカイブで動作します。ソース. リスト」ファイル。

続きを読む : APT-GET コマンドの 25 の便利な基本コマンド

適性

Aptitude は、Debian 用のテキストベースのパッケージ マネージャーで、「apt」のフロントエンドであり、ユーザーがパッケージを簡単に管理できるようにします。

シナプス

初心者でもパッケージのインストールアップグレード、 およびアンインストールを簡単に行えるグラフィカルなパッケージ マネージャー。

タスクセル

タスクセルを使用すると、ユーザーは特定のタスク、つまりデスクトップ環境に関連するすべてのパッケージをインストールできます。

選択を解除します

最初は初回インストール時に使用されていたメニュー形式のパッケージ管理ツールですが、 現在はaptitudeに置き換えられています。

Dpkg-deb

Debian アーカイブと対話します。

Dpkg 分割

大きなファイルを小さなファイルのチャンクに分割したり結合してフロッピー ディスクなどの小さなサイズのメディアに保存する場合に便利です。

Dpkgコマンド

dpkg は、Debian および Debian ベースのシステムの主要なパッケージ管理プログラムです。パッケージのインストールビルド削除、 および管理に使用されます。 Aptitudedpkg の主要なフロントエンドです。

最も一般的に使用されるdpkg コマンドの一部とその使用法を以下に示します。

1. パッケージをインストールする

.deb」パッケージをインストールするには、「-i」オプションを指定してコマンドを使用します。たとえば、「flashpluginnonfree_2.8.2+squeeze1_i386.deb」という「.deb」パッケージをインストールするには、次のコマンドを使用します。

[root@tecmint~]# dpkg -i flashpluginnonfree_2.8.2+squeeze1_i386.deb
Selecting previously unselected package flashplugin-nonfree.
(Reading database ... 465729 files and directories currently installed.)
Unpacking flashplugin-nonfree (from flashplugin-nonfree_3.2_i386.deb) ...
Setting up flashplugin-nonfree (1:3.2) ...
--2013-10-01 16:23:40--  http://fpdownload.macromedia.com/get/flashplayer/pdc/11.2.202.310/install_flash_player_11_linux.i386.tar.gz
Resolving fpdownload.macromedia.com (fpdownload.macromedia.com)... 23.64.66.70
Connecting to fpdownload.macromedia.com (fpdownload.macromedia.com)|23.64.66.70|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6923724 (6.6M) [application/x-gzip]
Saving to: ‘/tmp/flashplugin-nonfree.FPxQ4l02fL/install_flash_player_11_linux.i386.tar.gz’

2. インストールされているすべてのパッケージをリストします。

インストールされているすべてのパッケージを表示およびリストするには、コマンドと一緒に「-l」オプションを使用します。

[root@tecmint~]# dpkg -l
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                   Version                  Architecture    Description
+++-======================================-========================-===============================================================================
ii  accerciser                             3.8.0-0ubuntu1           all             interactive Python accessibility explorer for the GNOME desktop
ii  account-plugin-aim                     3.6.4-0ubuntu4.1         i386            Messaging account plugin for AIM
ii  account-plugin-facebook                0.10bzr13.03.26-0ubuntu1 i386            GNOME Control Center account plugin for single signon - facebook
ii  account-plugin-flickr                  0.10bzr13.03.26-0ubuntu1 i386            GNOME Control Center account plugin for single signon - flickr
ii  account-plugin-generic-oauth           0.10bzr13.03.26-0ubuntu1 i386            GNOME Control Center account plugin for single signon - generic OAuth
ii  account-plugin-google                  0.10bzr13.03.26-0ubuntu1 i386            GNOME Control Center account plugin for single signon
rc  account-plugin-identica                0.10bzr13.03.26-0ubuntu1 i386            GNOME Control Center account plugin for single signon - identica
ii  account-plugin-jabber                  3.6.4-0ubuntu4.1         i386            Messaging account plugin for Jabber/XMPP
....

インストールされている特定のパッケージを表示するか、パッケージ名とともにオプション「-l」を使用しないでください。たとえば、apache2 パッケージがインストールされているかどうかを確認します。

[root@tecmint~]# dpkg -l apache2
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                   Version                  Architecture    Description
+++-======================================-========================-==============================================
ii  apache2                                2.2.22-6ubuntu5.1        i386            Apache HTTP Server metapackage

3. パッケージを削除する

.deb」パッケージを削除するには、元の名前「flashplugin-nonfree_3.2_i386.debflashpluginnonfree」を指定する必要があります。強い>」。 「-r」 オプションは、 パッケージを削除/アンインストールするために使用されます。

[root@tecmint~]# dpkg -r flashpluginnonfree
(Reading database ... 142891 files and directories currently installed.) 
Removing flashpluginnonfree ... 
Processing triggers for man-db ... 
Processing triggers for menu ... 
Processing triggers for desktop-file-utils ... 
Processing triggers for gnome-menus ...

r」 の代わりに「p」 オプションを使用すると、構成ファイルとともにパッケージが削除されます。 「r」 オプションはパッケージのみを削除し、設定ファイルは削除しません。

[root@tecmint~]# dpkg -p flashpluginnonfree

4. パッケージの内容を表示する

特定のパッケージのコンテンツを表示するには、図のように「-c」オプションを使用します。このコマンドは、「.deb」パッケージの内容を長いリスト形式で表示します。

[root@tecmint~]# dpkg -c flashplugin-nonfree_3.2_i386.deb
drwxr-xr-x root/root         0 2012-12-14 22:54 ./
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/bin/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/lib/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/lib/mozilla/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/lib/mozilla/plugins/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/lib/flashplugin-nonfree/
-rw-r--r-- root/root      3920 2009-09-09 22:51 ./usr/lib/flashplugin-nonfree/pubkey.asc
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/share/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/share/man/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/share/man/man8/
-rw-r--r-- root/root       716 2012-12-14 22:54 ./usr/share/man/man8/update-flashplugin-nonfree.8.gz
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/share/applications/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/share/icons/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/share/icons/hicolor/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/share/icons/hicolor/24x24/
....

5. パッケージがインストールされているかどうかを確認します

パッケージ名とともに「-s」オプションを使用すると、deb パッケージがインストールされているかどうかが表示されます。

[root@tecmint~]# dpkg -s flashplugin-nonfree
Package: flashplugin-nonfree
Status: install ok installed
Priority: optional
Section: contrib/web
Installed-Size: 177
Maintainer: Bart Martens <[email >
Architecture: i386
Version: 1:3.2
Replaces: flashplugin (<< 6)
Depends: debconf | debconf-2.0, wget, gnupg, libatk1.0-0, libcairo2, libfontconfig1, libfreetype6, libgcc1, libglib2.0-0, libgtk2.0-0 (>= 2.14), libnspr4, libnss3, libpango1.0-0, libstdc++6, libx11-6, libxext6, libxt6, libcurl3-gnutls, binutils
Suggests: iceweasel, konqueror-nsplugins, ttf-mscorefonts-installer, ttf-dejavu, ttf-xfree86-nonfree, flashplugin-nonfree-extrasound, hal
Conflicts: flashplayer-mozilla, flashplugin (<< 6), libflash-mozplugin, xfs (<< 1:1.0.1-5)
Description: Adobe Flash Player - browser plugin
...

6. インストールされているパッケージの場所を確認する

システムにインストールされるファイルの場所をパッケージ名からリストします。

[root@tecmint~]# dpkg -L flashplugin-nonfree
/.
/usr
/usr/bin
/usr/lib
/usr/lib/mozilla
/usr/lib/mozilla/plugins
/usr/lib/flashplugin-nonfree
/usr/lib/flashplugin-nonfree/pubkey.asc
/usr/share
/usr/share/man
/usr/share/man/man8
/usr/share/man/man8/update-flashplugin-nonfree.8.gz
/usr/share/applications
/usr/share/icons
/usr/share/icons/hicolor
...

7. ディレクトリからすべてのパッケージをインストールする

指定されたディレクトリとそのすべてのサブディレクトリで見つかったパターン「*.deb」に一致するすべての通常のファイルを再帰的にインストールします。これは、「-R」および「-install」オプションとともに使用できます。たとえば、すべての「.deb」パッケージを「debpackages」というディレクトリからインストールします。

[root@tecmint~]# dpkg -R --install debpackages/
(Reading database ... 465836 files and directories currently installed.)
Preparing to replace flashplugin-nonfree 1:3.2 (using .../flashplugin-nonfree_3.2_i386.deb) ...
Unpacking replacement flashplugin-nonfree ...
Setting up flashplugin-nonfree (1:3.2) ...
Processing triggers for man-db ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus ...

8. パッケージを開梱しますが、構成は行いません

アクション「–unpack」を使用するとパッケージは解凍されますが、インストールや構成は行われません。

[root@tecmint~]# dpkg --unpack flashplugin-nonfree_3.2_i386.deb
(Reading database ... 465836 files and directories currently installed.)
Preparing to replace flashplugin-nonfree 1:3.2 (using flashplugin-nonfree_3.2_i386.deb) ...
Unpacking replacement flashplugin-nonfree ...
Processing triggers for man-db ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus ...

9. 解凍されたパッケージを再構成する

オプション「–configure」は、すでに解凍されているパッケージを再構成します。

[root@tecmint~]# dpkg --configure flashplugin-nonfree
Setting up flashplugin-nonfree (1:3.2) ...

10. 利用可能なパッケージ情報を置き換えます

–-update-avail」オプションは、古い情報をパッケージ ファイル内の利用可能な情報に置き換えます。

[root@tecmint~]# dpkg –-update-avail package_name

11. パッケージの既存の利用可能情報の消去

アクション「–clear-avaial」は、利用可能なパッケージに関する現在の情報を消去します。

[root@tecmint~]# dpkg –-clear-avail

12. アンインストールされたパッケージや利用できないパッケージを忘れる

dpkg コマンドにオプション「–forget-old-unavail」を指定すると、アンインストールされ使用できないパッケージが自動的に忘れられます。

[root@tecmint~]# dpkg --forget-old-unavail

13. dpkg ライセンスの表示

[root@tecmint~]# dpkg --licence

14. dpkg バージョンの表示

–version」引数には、dpkg のバージョン情報が表示されます。

[root@tecmint~]# dpkg –version
Debian `dpkg' package management program version 1.16.10 (i386).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.

15. dpkg に関するすべてのヘルプを取得する

–help」オプションを使用すると、dpkg コマンドで使用可能なオプションのリストが表示されます。

[root@tecmint~]# dpkg –help
Usage: dpkg [<option> ...] <command>

Commands:
  -i|--install       <.deb file name> ... | -R|--recursive <directory> ...
  --unpack           <.deb file name> ... | -R|--recursive <directory> ...
  -A|--record-avail  <.deb file name> ... | -R|--recursive <directory> ...
  --configure        <package> ... | -a|--pending
  --triggers-only    <package> ... | -a|--pending
  -r|--remove        <package> ... | -a|--pending
  -P|--purge         <package> ... | -a|--pending
  --get-selections [<pattern> ...] Get list of selections to stdout.
  --set-selections                 Set package selections from stdin.
  --clear-selections               Deselect every non-essential package.
  --update-avail <Packages-file>   Replace available packages info.
  --merge-avail <Packages-file>    Merge with info from file.
  --clear-avail                    Erase existing available info.
  --forget-old-unavail             Forget uninstalled unavailable pkgs.
  -s|--status <package> ...        Display package status details.
...

それは今のところすべてです。近いうちにまた別の興味深い記事をお届けする予定です。リストに記載されていないコマンドがある場合は、コメントでお知らせください。それまでは、Tecmint にご期待ください。 「いいね!」とシェアして拡散にご協力ください。コメントであなたの貴重な意見を言及することを忘れないでください。