Show Table of Contents
B.4. 実用的で一般的な RPM の使用例
RPM はシステムの管理や問題の診断と修正を行う上で便利なツールです。すべてのオプションを理解するには、いくつかの例を実際に見るのが最もよい方法です。
- 誤って何らかのファイルを削除してしまったものの、何を削除したかが分からないとします。システム全体を検証して足りないものを調べるには、以下のコマンドを試すことができます。
rpm -Va足りないファイルがあるか、壊れているファイルがあるように感じる場合は、おそらくパッケージを再インストールするか、いったんアンインストールして再インストールする必要があります。 - 所属先の分からないファイルを見つけたとします。そのファイルが含まれるパッケージを検索するには、以下のように入力します。
rpm -qf /usr/bin/ghostscript出力は以下のようになります:ghostscript-8.70-1.el6.x86_64
- 次のような方法で上記 2 つの例を組み合わせることもできます。例えば、
/usr/bin/pasteに問題があるとします。このプログラムが含まれるパッケージを検証しようにもpasteがどのパッケージに含まれるか分かりません。この場合は、次のコマンドを入力します。rpm -Vf /usr/bin/paste該当するパッケージが検証されます。 - 特定のプログラムに関して詳しい情報が必要なら、次のコマンドを入力して、そのプログラムを含むパッケージに付随するドキュメントの場所を確認することができます。
rpm -qdf /usr/bin/free出力は以下のようになります。/usr/share/doc/procps-3.2.8/BUGS /usr/share/doc/procps-3.2.8/FAQ /usr/share/doc/procps-3.2.8/NEWS /usr/share/doc/procps-3.2.8/TODO /usr/share/man/man1/free.1.gz /usr/share/man/man1/pgrep.1.gz /usr/share/man/man1/pkill.1.gz /usr/share/man/man1/pmap.1.gz /usr/share/man/man1/ps.1.gz /usr/share/man/man1/pwdx.1.gz /usr/share/man/man1/skill.1.gz /usr/share/man/man1/slabtop.1.gz /usr/share/man/man1/snice.1.gz /usr/share/man/man1/tload.1.gz /usr/share/man/man1/top.1.gz /usr/share/man/man1/uptime.1.gz /usr/share/man/man1/w.1.gz /usr/share/man/man1/watch.1.gz /usr/share/man/man5/sysctl.conf.5.gz /usr/share/man/man8/sysctl.8.gz /usr/share/man/man8/vmstat.8.gz
- 新しい RPM が見つかったものの、それが何かが分からないとします。何らかの情報を検索するには、以下のコマンド を使用します。
rpm -qip crontabs-1.10-32.1.el6.noarch.rpm出力は以下のようになります。Name : crontabs Relocations: (not relocatable) Version : 1.10 Vendor: Red Hat, Inc. Release : 32.1.el6 Build Date: Thu 03 Dec 2009 02:17:44 AM CET Install Date: (not installed) Build Host: js20-bc1-11.build.redhat.com Group : System Environment/Base Source RPM: crontabs-1.10-32.1.el6.src.rpm Size : 2486 License: Public Domain and GPLv2 Signature : RSA/8, Wed 24 Feb 2010 08:46:13 PM CET, Key ID 938a80caf21541eb Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> Summary : Root crontab files used to schedule the execution of programs Description : The crontabs package contains root crontab files and directories. You will need to install cron daemon to run the jobs from the crontabs. The cron daemon such as cronie or fcron checks the crontab files to see when particular commands are scheduled to be executed. If commands are scheduled, it executes them. Crontabs handles a basic system function, so it should be installed on your system.
- RPM がインストールする
crontabsファイルを見ることができます。以下のように入力します。rpm -qlp crontabs-1.10-32.1.el6.noarch.rpm出力は以下のようになります。/etc/cron.daily /etc/cron.hourly /etc/cron.monthly /etc/cron.weekly /etc/crontab /usr/bin/run-parts /usr/share/man/man4/crontabs.4.gz
以上、いくつか例を紹介しました。使用していくにつれて、RPM の用途がたくさんあることに気づくでしょう。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.