Friday, January 18, 2008

HowTo: Basic RPM Package Queries And Usage

RPM has been the standard binary for querying packages from RedHat and any other rpm-based OS like CentOS, WhiteBox, Fedora, Mandriva, Blag and 60+ more.

As a refresher, here are some basic patterns on how to query rpm packages using rpm package manager.

To search rpm database for all package that contains sendmail
# rpm -qa sendmail

To query rpm database for package with particular string
# rpm -qa | grep mail

Note that rpm package manager is a little bit sensitive on query search. The below might confuse you when doing a rpm query for SENDMAIL
# rpm -qa SENDMAIL

To query rpm database for specific package
# rpm -q sendmail

To install a particular rpm package
# rpm -ivh yum-2.4.0-2.noarch.rpm

To upgrade a currently installed rpm package
# rpm -Uvh yum-2.4.0-2.noarch.rpm

To query rpm database for rpm package info, package details, package size, package group, package version, source and more
# rpm -qi sendmail

To import public key using rpm
# rpm --import public-key

To install multiple rpm package
# rpm -ivh yum-2.4.0-2.noarch.rpm sendmail-8.13.4-2.i386.rpm

To query for package configuration files
# rpm -qc sendmail-8.13.8-2

To query for state of package files from package name
# rpm -qs sendmail

To query for package capabilities
# rpm -q --provides sendmail

To query for package requirements
# rpm -q --requires sendmail

To query rpm database for provided package
# rpm -q --whatprovides sendmail

To customize query result when doing query search
# rpm -q --queryformat '%{NAME}%{VERSION}%{RELEASE}\n' sendmail

To query rpm database with verbosity
# rpm -qavv sendmail

To query rpm database for files included with the package
# rpm -ql sendmail

There are a lot more rpm parameter we can ask rpm to give to us as the rpm package manager is a powerful commandline-driven package manager there is in Redhat-based linux distro. You can see more of rpm parameter flags by issuing rpm without any parameters like so

# rpm

Enjoy.

0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy