Menu Close
Red Hat Training
A Red Hat training course is available for Red Hat Enterprise Linux
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 の用途がたくさんあることに気づくでしょう。