Running RPM Commands
The primary RPM command is simply
rpm. One of the original goals of the RPM system is providing ease of use. In support of this goal, just about everything you want to do with the RPM system can be done with this one command. For most usage, the command-line parameters to the
rpmcommand determine the actions it should take.
Working with the
rpmcommand performs the most common package-management functions, along with a host of uncommon functions as well. The table below lists the main operations you can perform with the
rpmcommand and the command-line options to specify the given operations.
|Operation||Short Option||Long Option|
|Freshen (upgrade) already-installed package||-F||–freshen|
Using this table as a guide, you can explore the options to the
rpmcommand. To install or upgrade a package, use the
For example, to install the
mlocateRPM used as an example in this chapter, run the following command:
To get extra feedback, you can use a command like the following, with the
-voptions in conjunction with the
When you run this command you will see more output than the default, which is no output unless there are errors. With the
rpmcommand will print a series of hash marks, #, to provide feedback that the command is still running. With the
rpmcommand provides more verbose messages.
Installing a Package
The most common command to install a package is:
This command upgrades a package with extra output. If the package has not been installed, this command installs the package. See Chapter 3, Using RPM for more on upgrading and installing.
To remove a package (called erase in RPM terminology), use the
Using File Extensions
Notice that you install a package file using the file name that ends in .rpm, but uninstall or erase a package without the .rpm extension. This is because you install RPM files, but once installed, you work with the installed packages. The file name and the package name do not have to correspond, but typically (and sanely) they have the same base name.
To list every RPM package installed on your system, use a command like the following.
Expect to wait while this command completes. Most Linux systems have numerous packages installed, which will result in many lines of output. To better see the output, you can pipe this command to the more command, as shown following:
rpm –qa | more
You will then see the package listing one screen at a time.
Chapter 21, RPM Command Reference lists all the options for the