RPM RedHat Package ManagerRPM is the Red Hat package manager. It is a program designed to build and manage packages of software including the source and binaries. It is portable and can be run on different platforms. RPMs (*.rpm) typically include the compiled programs and/or libraries needed for the package, documentation, install, verify, and uninstall scripts, and cryptographic signatures for each file in the package. This makes it easy to verify the integrity of the package. It also includes a list of packages that it depends on, and a list of services that are provided by the package. RPM maintains a database of all installed packages in /var/lib/rpm/*. Included in the database is a list of all files installed by RPM and which package they belong to. This makes it a very powerful tool for finding out more about each package. Sources are often provided in source RPMs (*.src.rpm or *.spm). These sources include the pristine developer source code, any patches applied by the package builder, and a SPEC file that is used to tell rpm how to compile the package. You have to logged in as user root to install, upgrade, or remove packages. You can run queries as any user. The RPM package format has been adopted by many major distributions besides Red Hat, including SuSE, Caldera, and TurboLinux. These commands query a package that has already been installed. To query a package that has NOT been installed yet, add the -p option to the command.
To build/install an rpm source package
To extract the sources and apply patches from a source package (without building an rpm)
To bypass running the scripts in a package, use the --no-scripts option. There are 5 possible scripts in an rpm package:
If you suspect the RPM database has been corrupted, run rpm --rebuilddb to rebuild it and try to recover from any errors. To extract an individual file from an rpm package without installing the rpm:
If you want to remove a list of RPMs without typing each on separately, you can use the xargs command with rpm. Here are the commands and output from a session where I wanted to delete several RPMs at once. First, I used rpm -qa to find all the xine RPMs. When I verified the list, I passed the list to xargs to execute an rpm -e on each of them. The final rpm -qa verifies that they have all been uninstalled. artifact:~/datacore/suse-7.3/xine # rpm -qa | grep xine xine-lib-0.9.7-0 xine-lib-aa-0.9.7-0 xine-lib-alsa05-0.9.7-0 xine-lib-arts-0.9.7-0 xine-lib-d4d-0.9.7-0 xine-lib-docs-0.9.7-0 xine-lib-oggvorbis-0.9.7-0 xine-lib-oss-0.9.7-0 xine-lib-w32dll-0.9.7-0 xine-ui-0.9.7-0 xine-ui-aa-0.9.7-0 artifact:~/datacore/suse-7.3/xine # rpm -qa | grep xine | xargs rpm -e artifact:~/datacore/suse-7.3/xine # rpm -qa | grep xine artifact:~/datacore/suse-7.3/xine # | |||||||||||||||||||||