In general, normal usage of the rpm command can be summarized with installation, upgrading, removal and querying. Below you
will find the common usage of the rpm command as well as some of the options.
Installation/Upgrading/Removal
o To install a package: rpm -ivh <filename>
rpm -ivh somepackage.x.y-z.<arch>.rpm
o To upgrade a package: rpm -Uvh <filename>
rpm -Uvh somepackage.1.1-5.i386.rpm
o To remove a package: rpm -e <packagename>
rpm -e somepackage
o Also, for upgrading or installing some packages, you may need to use additional flags to force the install to
occur. It is only recommended to use these if you know why these flags were needed.
--force will overwrite files that are owned by other packages.
--nodeps will install even if the package needs packages that were not installed.
Querying
o To see if a package is installed: rpm -q <packagename>
rpm -q somepackage
o To get info on an installed package: rpm -qi <packagename>
rpm -qi somepackage
o To list which files belong to a package: rpm -ql <packagename>
rpm -ql somepackage
o To see what package a file belongs to: rpm -qf <path-to-filename>
rpm -qf /usr/bin/some_executable
o To see what configuration belongs to particular rpm: rpm -qc <rpm_name>
rpm -qc somepackage
One can usually join various query commands together, so rpm -qil will give info and list all the files in the package.
To look at an RPM filename that is not installed, you add the p to the query line.
rpm -qilp somepackage.1.1-4.i386.rpm
This will list the information and the files contained in <somepackage>. More advanced usage can be found in the man page for
RPM and at the website, http://www.rpm.org.
Verification
To see what files on the system may have changed from their initial settings, you can use RPM to check up on them.
The command rpm -Va will give you a list of all files that have changed in one form or another since the package associated
with it was installed. This can be a lot of files (and a lot may be changed due to post installation work). To just see what
packages have changed so that you can verify them more individually, you can do the following:
rpm -Va --pipe "awk '{print $2}' | xargs rpm -qf | sort -u" &> /tmp/file1
Then look in the file /tmp/file1 to see all of the packages that have been changed after their installation.
Soruce: Redhat KB

















Author




Logged


