Google Site SearchFN Site Search FN Blog Login FN Blog Login
Site Navigation:
 
 

All you have to know about RPM

by Alexandre de Abreu

How can I query installed packages? What about a RPM file?

For simply query a installed package do:

rpm -q yum

Here we used the "-q" parameter, that indicates we're executing a query. The above command will returns true(Shell variable $? = 0) if the yum package is installed. Note that you can also use the full name with version/release numbers like this:

rpm -q yum-2.0.4-2

If you want to know all installed packages on your system, add the parameter "-a" executing the following command:

rpm -qa

An interesting command for checking if a package is installed or to find out all packages that match a string is:

rpm -qa | grep -i python

In this case it will print the packages that matches the string "python", the "-i" grep parameter is the "insensitive" case, here's a sample output:

# rpm -qa | grep -i python
gnome-python2-canvas-2.0.0-2
libxml2-python-2.5.11-1
gnome-python2-bonobo-2.0.0-2
gnome-python2-2.0.0-2
rpm-python-4.2.1-0.30
gnome-python2-gtkhtml2-2.0.0-2
python-optik-1.4.1-1
python-2.2.3-7
python-devel-2.2.3-7
mod_python-3.0.4-0.1

And what about a RPM file? Imagine that we'd like to query a package that are not installed. This can be useful in many cases. If you've just downloaded the package from Internet and like to retrieve its info try the following:

rpm -qpi vnc-server-4.0-0.beta4.3.2.i386.rpm

By running the above command all the information about the package will be printed on screen. When using "-p" query parameter RPM knows that it's treating a file, in this case the VNC RPM package. Note that the "-i" parameter here is used in "Query Mode", it's not the install one.

Here is the output of the command:

# rpm -qip vnc-server-4.0-0.beta4.3.2.i386.rpm
Name        : vnc-server                   Relocations: (not relocateable)
Version     : 4.0                               Vendor: Red Hat, Inc.
Release     : 0.beta4.3.2                   Build Date: Mon 17 Nov 2003 04:54:54 PM BRST
Install Date: (not installed)               Build Host: daffy.perf.redhat.com
Group       : User Interface/X              Source RPM: vnc-4.0-0.beta4.3.2.src.rpm
Size        : 3094107                          License: GPL
Signature   : DSA/SHA1, Mon 17 Nov 2003 05:31:09 PM BRST, Key ID b44269d04f2a6fd2
Packager    : Red Hat, Inc. 
URL         : http://www.realvnc.com
Summary     : A VNC server.
Description :
The VNC system allows you to access the same desktop from a wide
variety of platforms. This package is a VNC server, allowing others to
access the desktop on your machine.

On next pages you'll see other types of queries. Click on the right blue arrow to continue.