GNU/Linux >> Linux の 問題 >  >> Debian

Ubuntu/Debianでパッケージを管理するためのDpkgコマンドの例

Dpkg

Dpkg(Debian Package)は、DebianおよびUbuntuのようなDebianベースのLinuxディストリビューションのパッケージ管理システムです。

Dpkgは、実際にはパッケージを管理するための低レベルのコマンドラインユーティリティです。 apt-getやgdebiなどのツールとは異なります。

Apt-getとGdebiは、依存関係を解決してインストールし、メインパッケージが正しく機能するようにすることができるより高度なツールです。

このクイックチュートリアルでは、dpkgコマンドのいくつかの基本的な例と、それを使用してシステム上のパッケージを管理する方法を見ていきます。

dpkgコマンドは、Debian、Ubuntu、Linux Mint、ElementaryOSなどのシステムで機能します。

Dpkgコマンドの例

1。インストールされているすべてのパッケージを一覧表示する

このコマンドは、インストールされているすべてのパッケージを一覧表示します。情報は、名前、バージョン、アーキテクチャ、および説明の列を含む表形式で印刷されるものとします。リストは膨大で、上下にスクロールできます。

$ 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  accountsservice                                 0.6.55-0ubuntu10                            amd64        query and manipulate user account information
ii  accountwizard                                   4:19.04.3-0ubuntu1                          amd64        wizard for KDE PIM applications account setup
ii  acl                                             2.2.53-4                                    amd64        access control list - utilities
ii  acpi-support                                    0.143                                       amd64        scripts for handling many ACPI events

2。インストールされているパッケージを検索する

インストールされているパッケージのリストで特定のエントリを検索して、インストールされているかどうかを確認できます。

インストールされているパッケージで「apache」を検索します

$ dpkg --get-selections | grep 'apache'
apache2                                         install
apache2-mpm-prefork                             install
apache2-suexec                                  install
apache2-utils                                   install
apache2.2-bin                                   install
apache2.2-common                                install
libapache-pom-java                              install
libapache2-mod-fcgid                            install
libapache2-mod-php5                             install

または、同じlオプションを使用して、インストールされているパッケージを検索します。これは実際には簡単です。

$ dpkg -l php*
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
+++-===============================-====================-====================-====================================================================
un  php-doc                         <none>                                    (no description available)
un  php-imlib                       <none>                                    (no description available)
un  php-kolab-filter                <none>                                    (no description available)
un  php-openid                      <none>                                    (no description available)
un  php-pear                        <none>                                    (no description available)
un  php-radius-legacy               <none>                                    (no description available)
ii  php5                            5.4.6-1ubuntu1.2     all                  server-side, HTML-embedded scripting language (metapackage)
ii  php5-cgi                        5.4.6-1ubuntu1.2     amd64                server-side, HTML-embedded scripting language (CGI binary)
ii  php5-cli                        5.4.6-1ubuntu1.2     amd64                command-line interpreter for the php5 scripting language
ii  php5-common                     5.4.6-1ubuntu1.2     amd64                Common files for packages built from the php5 source

3。パッケージによってインストールされたファイルを一覧表示する

特定のパッケージによってインストールされるすべてのファイルのパスを見つけるには、dpkgで「L」オプションを使用します

$ dpkg -L php5-cli
/.
/etc
/etc/php5
/etc/php5/cli
/usr
/usr/share
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/php5.1.gz
/usr/share/doc
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/php5-cli
/usr/lib
/usr/lib/php5
/usr/lib/php5/20100525
/usr/bin
/usr/bin/php5
/etc/php5/cli/conf.d
/usr/share/doc/php5-cli

その他の例

dpkg -i <package.deb> 
Installs a Debian package file; one that you downloaded manually, for example.

dpkg -c <package.deb> 
Lists the contents of <package.deb>, a .deb file.

dpkg -I <package.deb> 
Extracts package information from <package.deb>, a .deb file.

dpkg -r <package> 
Removes an installed package named <package>

dpkg -P <package> 
Purges an installed package named <package>. The difference between remove and purge is that while remove only deletes data and executables, purge also deletes all configuration files in addition.

dpkg -L <package> 
Gives a listing of all the files installed by <package>. See also dpkg -c for checking the contents of a .deb file.

dpkg -s <package> 
Shows information on the installed package <package>. See also apt-cache show for viewing package information in the Debian archive and dpkg -I for viewing package information extracted from a .deb file.

dpkg-reconfigure <package> 

Reconfigures an installed package, if it uses debconf (debconf provides that consistent configuration interface for package installation). You can reconfigure debconf itself if you want to change the front-end or priority of questions asked. For example, to reconfigure debconf with the dialog front-end, you simply run:

dpkg-reconfigure --frontend=dialog debconf

echo ``<package> hold'' | dpkg --set-selections 
Put <package> on hold (command line method)

dpkg --get-selections ``<package>'' 
Get the current status of <package> (command line method)

dpkg -S <file> 
Searches for <file> in package database, telling you which packages have that file in them.

インストールされたパッケージを再構成する

パッケージは、dpkg-reconfigureコマンドを使用して再構成できます。

たとえば、phpmyadminの再構成:

$ dpkg-reconfigure phpmyadmin

結論

これらはdpkgコマンドのいくつかの基本的な例です。ほとんどの場合、dpkgパッケージは低レベルのコマンドであり、.debパッケージのインストールまたは削除の基本的な機能しか提供しないため、パッケージ管理にdpkgパッケージを使用することはおそらくないでしょう。

リポジトリを管理せず、メインパッケージが正しく機能するための依存関係を見つけてインストールしません。

apt-get、aptitude、apt、gdebiなどの他のコマンドは、システムにパッケージをインストールして維持するために使用する必要があります。

フィードバックや質問がある場合は、下のコメントでお知らせください。


Debian
  1. debian /ubuntudpkgコマンドで頻繁に使用されるオプション

  2. Ubuntu 16.04 / 14.04 /Debian9/8にownCloud10をインストールします

  3. Debian11にJava17をインストールする方法

  1. DebianLinuxにUbuntuPPAからパッケージをインストールする

  2. Ubuntu /DebianLinuxでの15のaptコマンド例

  3. Ubuntu/Debianでパッケージを管理するためのAptgetコマンドの例

  1. Debian11にNextcloudをインストールする方法

  2. Debian11にGradleをインストールする方法

  3. Debian11にWebminをインストールする方法