rpm commands for package manager

This post has been originaly made for my friend mainak, who is just learning gnu/linux, installed FC6 and have came to me with several queries on rpm..so i just thought to put it here for others also .

common usage of the rpm command as well as some of the options.

Installation/Upgrading/Removal :

To install a package: rpm -ivh

rpm -ivh somepackage.x.y-z..rpm

To upgrade a package: rpm -Uvh

rpm -Uvh somepackage.1.1-5.i386.rpm

To remove a package: rpm -e

rpm -e somepackage

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 :

To see if a package is installed: rpm -q

rpm -q somepackage

To get info on an installed package: rpm -qi

rpm -qi somepackage

To list which files belong to a package: rpm -ql

rpm -ql somepackage

To see what package a file belongs to: rpm -qf

rpm -qf /usr/bin/some_executable

To see what configuration belongs to particular rpm: rpm -qc

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 . 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.

Tags: , ,

This entry was posted on Thursday, March 1st, 2007 at 5:32 pm and is filed under gnu/linux. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “rpm commands for package manager”

mainak March 2nd, 2007 at 5:12 pm

thanx for the info….will be of great use to me .Really appreciate your help.
thanx again.

Leave a Reply

You must be logged in to post a comment.