RPM Package manager – Using RPM Commands
RPM Package Manager is a package management system. The name RPM refers to two things: a software package file format, and software packaged in this format.
This document contains an overview of the principal RPM commands for installing, uninstalling, upgrading, querying, listing and checking RPM packages on your Linux system.
To install a RPM package, use the command:
# rpm -ivh foo-1.1-2.i386.rpm
Take a note that RPM packages have a file of names like foo-1.1-2.i386.rpm, which include the package name (foo), version (1.1), release (2), and architecture (i386).
To uninstall a RPM package, use the command:
# rpm -e foo
Notice that we used the package name foo, not the name of the original package file foo-1.1-2.i386.rpm.
To upgrade a RPM package, use the command:
# rpm -Uvh foo-1.1-2.i386.rpm
With this command, RPM automatically uninstall the old version of foo package and install the new one. Always use rpm -Uvh to install packages, since it works fine even when there are no previous versions of the package installed.
To query a RPM package, use the command:
# rpm -q foo
This command will print the package name, version, and release number of installed package foo. Use this command to verify that a package is or is not installed on your system.
To display package information, use the command:
# rpm -qi foo
This command display package information; includes name, version, and description of the installed program. Use this command to get information about the installed package.
To list files in package, use the command:
# rpm -ql foo
This command will list all files in a installed RPM package. It works only when the package is already installed on your system.
To check a RPM signature package, use the command:
# rpmĀ --checksig foo
This command checks the PGP signature of specified package to ensure its integrity and origin. Always use this command first before installing new RPM package on your system. Also, GnuPG or Pgp software must be already installed on your system before you can use this command.
Let's say you delete some files by accident, but you aren't sure what you deleted. If you want to verify your entire system and see what might be missing, you would do:
# rpm -Va
Let's say you run across a file that you don't recognize. To find out which package owns it, you would do:
# rpm -qf /etc/httpd/conf/httpd.conf
The output would be something like:
httpd-2.2.3-31.el5.centos
Print This Post