Running Linux, 5th Edition - Matthias Kalle Dalheimer [220]
If you already have an RPM system, installing RPM packages is very easy. Let's say that you have an RPM package called SuperFrob-4.i386.rpm (RPM packages always have the extension .rpm; the i386 indicates that this is a binary package compiled for Intel x86 machines). You could then install it with:
tigger # rpm -i SuperFrob-4.i386.rpm
Instead of -i, you can also use the long-named version of this option; choose whatever you like better:
tigger # rpm --install SuperFrob-4.i386.rpm
If everything goes well, there will be no output. If you want RPM to be more verbose, you can try:
tigger # rpm -ivh SuperFrob-4.i386.rpm
This prints the name of the package plus a number of hash marks so that you can see how the installation progresses.
If the package you want to install needs another package that is not yet installed, you will get something like the following:
tigger # rpm -i SuperFrob-4.i386.rpm
failed dependencies:
frobnik-2 is needed by SuperFrob-4
If you see this, you have to hunt for the package frobnik-2 and install this first. Of course, this package can itself be dependent on other packages.
If you want to update a package that is already installed, use the -U or --update option (which is just the -i option combined with a few more implied options):
tigger # rpm -U SuperFrob-5.i386.rpm
Uninstalling a package is done with the -e or --erase option. In this case, you do not specify the package file (you might not have that around any longer), but rather, the package name and version number:
tigger # rpm -e SuperFrob-5
Besides the options described so far that alter the state of your system, the -q option provides various kinds of information about everything that is recorded in the RPM database as well as package files. Here are some useful things you can do with -q:
Find out the version number of an installed package: tigger# rpm -q SuperFrob
SuperFrob-5
Get a list of all installed packages: tigger# rpm -qa
SuperFrob-5
OmniFrob-3
...
glibc-2.3.4-23.4
Find out to which package a file belongs: tigger# rpm -qf /usr/bin/dothefrob
SuperFrob-5
tigger# rpm -qf /home/kalle/.xinitrc
file /home/kalle/.xinitrc is not owned by any package
Display information about the specified package: tigger# rpm -qi rpm
Name : rpm Relocations: (not relocatable)
Version : 4.1.1 Vendor: SUSE LINUX Products GmbH,
Nuernberg, Germany
Release : 208.2 Build Date: Sat 11 Jun 2005 01:53:04
AM CEST
Install date: Tue 28 Jun 2005 10:02:18 AM CEST Build Host: purcell.suse.de
Group : System/Packages Source RPM: rpm-4.1.1-208.2.src.rpm
Size : 5970541 License: GPL
Signature : DSA/SHA1, Sat 11 Jun 2005 01:58:41 AM CEST, Key ID a84edae89c800aca
Packager : http://www.suse.de/feedback
Summary : The RPM Package Manager
Description :
RPM Package Manager is the main tool for managing the software packages
of the SuSE Linux distribution.
...
Distribution: SuSE Linux 9.3 (i586)
Show the files that will be installed for the specified package file: tigger# rpm -qpl SuperFrob-5.i386.rpm
/usr/bin/dothefrob
/usr/bin/frobhelper
/usr/doc/SuperFrob/Installation
/usr/doc/SuperFrob/README
/usr/man/man1/dothefrob.1
What we've just finished showing are the basic modes of operation, which are supplemented by a large number of additional options. You can check those in the manual page for the rpm(8) command.
If you are faced with an RPM package that you want to install, but have a system such as Slackware or Debian that is not based on RPM, things get a little bit more difficult.
You can either use the fairly self-explanatory command alien that can convert between various package formats and comes with most distributions, or you can build the RPM database from scratch.
The first thing you have to do in this latter case is to get the rpm program itself. You can download it from http://www.rpm.org. Follow the installation instructions to build and install it; if you have the C compiler gcc installed on your system, there should be no problems