10. Package Management with RPM
-i # Install a package.
-U # Upgrade existing package or install if it doesn’t already exist.
-e # Remove a package.
-F # Freshen. Only upgrade package if it’s already installed.
-v # Print verbose information
-h # Use a hash mark (#) to indicate progress
–nodeps # Don’t perform a dependency check when installing or upgrading a package
–replacefiles # Install package even if it overwrites existing files
–replacepkgs # Install package even if it’s already installed
–oldpackage # Install package even if it’s older than the one installed
–force # Combination of –replacefiles, –replacepkgs, and –oldpackage
rpm -ivh groff-1.17.1-3.i386.rpm # Install groff from local file sytsem
rpm -Uvh groff-1.17.2-3.i386.rpm # Upgrade groff from local file system
rpm -e groff # Remove groff
# Install groff from anonymous ftp server
rpm -ivh ftp://somehost.com/rpms/groff-1.17.1-3.i386.rpm
# Install groff from non-anonymous ftp server
rpm -ivh ftp://
–nogpg # Don’t verify gpg signature (must be used with –checksig).
-Va # Verify all packages
10.4 Source RPMs
Source RPMS install their contents into /usr/src/redhat. They contain everything necessary to build a binary package from the source (source code, init scripts, config files, man pages, documentation, etc.)
* SOURCES – Contains source code and patches necessary to build rpm.
* BUILD – A work directory used to build the rpm.
* SPECS – Holds the spec files which describe how to build the rpm.
* SRPMS – Stores the completed source RPM after it’s built.
* RPMS – Stores the completed binary RPM after it’s built.
10.5 Spec Files
The RPM spec file contains the necessary instructions required to build an RPM. It contains many sections:
Preamble # Contains package information
Prep # Prepares source code for building (unpacking, patching, etc.)
Build # Steps taken to build source
Install # Commands used to install package
Install & Uninstall Scripts # Scripts that install/uninstall package from a system
Verify # Extra verification steps to take when verifying packages
Clean # Cleanup script
File List # List of files in the package
10.6 Build Options
-bp # Only execute prep stage
-bl # verify all files exist
-bc # Execute only the build stage
-bi # Execute only the install section
-bs # Only build SRPM
-ba # Build binary and source RPMs
-bb # Build binary RPM only