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 に問題があるとします。そのプログラムを所有するパッケージを確認しますが、どのパッケージが 貼り付ける かは分からません。以下のコマンドを入力します。
    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.
  • 場合によっては、crontabs RPM パッケージがどのファイルをインストールするかを見てみましょう。以下を入力します。
    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 を使用する際には、その使用がさらに分かっている可能性があります。