Three basic software installations are covered here -- using the Red Hat Package Manager, compiling software using the standard GNU compilation method, and compiling and installing the software by hand. (From the book Linux Administration, A Beginner's Guide, third edition by Steven Graham and Steve Shah, McGraw-Hill/Osborne, 0072225629, 2002).
The easiest way to install a new package is to use the -i option with RPM. For example, if you downloaded a package called bc-1.05a-4.i386.rpm and wanted to install it, you would type:
[root@ford /root]# rpm -ivh bc-1.05a-4.i386.rpm
If the installation went fine, you would not see any errors or messages. This is the most common method of installing RPMs. On the other hand, if the package already exists, you would see this message:
error: package bc-1.05a-4 is already installed
Some packages rely on other packages. A game, for example, may depend on SVGA libraries having already been installed. In those instances, you will get a message indicating which packages need to be installed first. Simply install those packages and then come back to the original package.
If you need to upgrade a package that already exists, use the -U option, like so:
[root@ford /root]# rpm -Uv bc-1.05a-4.i386.rpm
Some additional command-line options to RPM are listed in Table 1.
Command-Line Option
Description
--force
This is the sledgehammer of installation. Typically, you use it when you’re knowingly installing an odd or unusual configuration, and RPM’s safeguards are trying to keep you from doing so. The --force option tells RPM to forego any sanity checks and just do it, even if it thinks you’re trying to fit a square peg into a round hole. Be careful with this option.
-h
Prints hash marks to indicate progress during an installation. Use with the -v option for a pretty display.
--percent
Prints the percentage completed to indicate progress. It is handy if you’re running RPM from another program, such as a Perl script, and you want to know the status of the install.
-nodeps
If RPM is complaining about missing dependency files, but you want the installation to happen anyway, passing this option at the command line will cause RPM to not perform any dependency checks.
-q
Queries the RPM system for information.
--test
This option does not perform a real installation; it just checks to see whether an installation would succeed. If it anticipates problems, it displays what they’ll be.
-V
Verifies RPMs or files on the system.
-v
Tells RPM to be verbose about its actions.
Table 1RPM Command-Line Options
For example, to force the installation of a package regardless of dependencies or other errors, you would type:
where packagename.rpm is the name of the package being installed.
Querying a Package
Sometimes it is handy to know which packages are currently installed and what they do. You can do that with the RPM query options.
To list all installed packages, simply type:
[root@ford /root]# rpm -qa
Be ready for a long list of packages! If you are looking for a particular package name, you can use the grep command to specify the name (or part of the name) of the package, like so:
[root@ford /root]# rpm -qa | grep -i ' name'
NOTEThe -i parameter in grep tells it to make its search case-insensitive.
If you just want to view all of the packages one screen at a time, you can use the more command, like so:
[root@ford /root]# rpm -qa | more
To find out which package a particular file belongs to, type:
[root@ford /root]# rpm -qf filename
where filename is the name of the file that you want to check on.
To find out the purpose of a package that is already installed, you must first know the name of the package (taken from the listing in rpm -qa) and then specify it, like so:
[root@ford /root]# rpm -qi packagename
where packagename is the name of the package that you want information about.
To find out what files are contained in a package, type:
[root@ford /root]# rpm -qlp packagename
where packagename is the name of the package that you want information about.
This chapter is from Linux Administration, A Beginner's Guide, third edition, by Graham and Shah. (McGraw-Hill/Osborne, 2002, ISBN: 0072225629). Check it out at your favorite bookstore today.