Product SiteDocumentation Site

B.2.2. インストールとアップグレード

RPM packages typically have file names like tree-1.5.3-2.fc16.x86_64.rpm. The file name includes the package name (tree), version (1.5.3), release (2), operating system major version (fc16) and CPU architecture (x86_64).
rpm-U オプションを使用できます:
That is, rpm -U <rpm_file> is able to perform the function of either upgrading or installing as is appropriate for the package.
Assuming the tree-1.5.3-2.fc16.x86_64.rpm package is in the current directory, log in as root and type the following command at a shell prompt to either upgrade or install the tree package as determined by rpm:
rpm -Uvh tree-1.5.3-2.fc16.x86_64.rpm

Use -Uvh for nicely-formatted RPM installs

The -v and -h options (which are combined with -U) cause rpm to print more verbose output and display a progress meter using hash signs.
If the upgrade/installation is successful, the following output is displayed:
Preparing...                ########################################### [100%]
   1:tree                   ########################################### [100%]

Always use the -i (install) option to install new kernel packages!

rpm provides two different options for installing packages: the aforementioned -U option (which historically stands for upgrade), and the -i option, historically standing for install. Because the -U option subsumes both install and upgrade functions, we recommend to use rpm -Uvh with all packages except kernel packages.
You should always use the -i option to simply install a new kernel package instead of upgrading it. This is because using the -U option to upgrade a kernel package removes the previous (older) kernel package, which could render the system unable to boot if there is a problem with the new kernel. Therefore, use the rpm -i <kernel_package> command to install a new kernel without replacing any older kernel packages. For more information on installing kernel packages, refer to 20章カーネルをアップグレードする.
パッケージの署名は、パッケージのインストールまたはアップグレード時に自動的にチェックされます。署名により、パッケージが認証機関によって署名されたことを確認できます。たとえば、署名の検証が失敗すると、次のようなエラーメッセージが表示されます。
error: tree-1.5.2.2-4.fc16.x86_64.rpm: Header V3 RSA/SHA256 signature: BAD, key ID
d22e77f2
ヘッダのみの新しい署名なら、次のようなエラーメッセージが表示されます。
error: tree-1.5.2.2-4.fc16.x86_64.rpm: Header V3 RSA/SHA256 signature: BAD,
key ID d22e77f2
If you do not have the appropriate key installed to verify the signature, the message contains the word NOKEY:
warning: tree-1.5.2.2-4.fc16.x86_64.rpm: Header V3 RSA/SHA1 signature: NOKEY, key ID 57bbccba
Refer to 「パッケージの署名を確認する」 for more information on checking a package's signature.

B.2.2.1. すでにインストールされているパッケージ

If a package of the same name and version is already installed , the following output is displayed:
Preparing...                ########################################### [100%]
	package tree-1.5.3-2.fc16.x86_64 is already installed
However, if you want to install the package anyway, you can use the --replacepkgs option, which tells RPM to ignore the error:
rpm -Uvh --replacepkgs tree-1.5.3-2.fc16.x86_64.rpm
このオプションは、RPM からインストールされた ファイルが削除された場合や、RPM からオリジナルの 設定ファイルをインストールしたい場合に便利です。

B.2.2.2. ファイルの競合

If you attempt to install a package that contains a file which has already been installed by another package , the following is displayed:
Preparing... ##################################################
 file /usr/bin/foobar from install of foo-1.0-1.fc16.x86_64 conflicts
with file from package bar-3.1.1.fc16.x86_64
To make RPM ignore this error, use the --replacefiles option:
rpm -Uvh --replacefiles foo-1.0-1.fc16.x86_64.rpm

B.2.2.3. 未解決の依存性

RPM packages may sometimes depend on other packages , which means that they require other packages to be installed to run properly. If you try to install a package which has an unresolved dependency, output similar to the following is displayed:
error: Failed dependencies:
	bar.so.3()(64bit) is needed by foo-1.0-1.fc16.x86_64
If you are installing a package from the Fedora installation media, such as from a CD-ROM or DVD, the dependencies may be available. Find the suggested package(s) on the Fedora installation media or on one of the active Fedora mirrors and add it to the command:
rpm -Uvh foo-1.0-1.fc16.x86_64.rpm    bar-3.1.1.fc16.x86_64.rpm
両方のパッケージのインストールが正常に行なわれると、以下のような出力が表示されます。
Preparing...                ########################################### [100%]
   1:foo                   ########################################### [ 50%]
   2:bar                   ########################################### [100%]
You can try the --whatprovides option to determine which package contains the required file.
rpm -q --whatprovides "bar.so.3"
If the package that contains bar.so.3 is in the RPM database, the name of the package is displayed:
bar-3.1.1.fc16.i586.rpm

警告: 強制的なパッケージのインストール

Although we can force rpm to install a package that gives us a Failed dependencies error (using the --nodeps option), this is not recommended, and will usually result in the installed package failing to run. Installing or removing packages with rpm --nodeps can cause applications to misbehave and/or crash, and can cause serious package management problems or, possibly, system failure. For these reasons, it is best to heed such warnings; the package manager—whether RPM, Yum or PackageKit—shows us these warnings and suggests possible fixes because accounting for dependencies is critical. The Yum package manager can perform dependency resolution and fetch dependencies from online repositories, making it safer, easier and smarter than forcing rpm to carry out actions without regard to resolving dependencies.