Tech Support Notes

RPM

RPM is a powerful and mature command-line driven package management system capable of installing, uninstalling, verifying, querying, and updating Unix software packages. Each software package consists of an archive of files along with information about the package like its version, a description, and the like. There is also a library API, permitting advanced developers to manage such transactions from programming languages such as C, Perl or Python.

Common flags

-v : verbose
-h : print hash marks as the package archive is unpacked.
-q : query operation
-a : queries all installed packages
-U : upgrade -l : list the files in the package
-p : specify the package name

Install a local RPM using rpm -i

rpm -ivh /path/to/local.rpm

Upgrade an RPM Package using rpm -Uvh

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh /path/to/local.rpm

Remove an RPM with rpm -e

rpm -ev /path/to/local.rpm

Remove an RPM but keep the dependencies installed

rpm -ev --nodeps /path/to/local.rpm

Find which RPM package a file belongs to Use rpm -qf

[europa] (~) >>> rpm -qf /usr/bin/ssh
openssh-clients-6.2p1-1

Locate documentation of a package that owns file using rpm -qdf

[europa] (~) >>> rpm -qdf /usr/bin/ssh
/usr/share/man/man1/sftp.1.gz
/usr/share/man/man1/slogin.1.gz
/usr/share/man/man1/ssh-add.1.gz
/usr/share/man/man1/ssh-agent.1.gz
/usr/share/man/man1/ssh-keyscan.1.gz
/usr/share/man/man1/ssh.1.gz
/usr/share/man/man5/ssh_config.5.gz

Get information about Installed RPM Package using rpm -qi

[europa] (~) >>> rpm -qi openssh
Name        : openssh                      Relocations: (not relocatable)
Version     : 6.2p1                             Vendor: (none)
Release     : 1                             Build Date: Sun 28 Jul 2013 02:49:26 PM CDT
Install Date: Sun 28 Jul 2013 02:50:30 PM CDT      Build Host: europa.particlescatter.com
Group       : Applications/Internet         Source RPM: openssh-6.2p1-1.src.rpm
Size        : 1113794                          License: BSD
Signature   : (none)
URL         : http://www.openssh.com/portable.html
Summary     : The OpenSSH implementation of SSH protocol versions 1 and 2
Description :
SSH (Secure SHell) is a program for logging into and executing
commands on a remote machine. SSH is intended to replace rlogin and
rsh, and to provide secure encrypted communications between two
untrusted hosts over an insecure network. X11 connections and
arbitrary TCP/IP ports can also be forwarded over the secure channel.

OpenSSH is OpenBSD's version of the last free version of SSH, bringing
it up to date in terms of security and features, as well as removing
all patented algorithms to separate libraries.

This package includes the core files necessary for both the OpenSSH
client and server. To make this package useful, you should also
install openssh-clients, openssh-server, or both.

Query all the RPM Packages using rpm -qa

[callisto] (~) >>> rpm -qa openssl
openssl-1.0.1e-16.el6_5.7.x86_64

List all the Files in a Package using rpm -qlp

[callisto] (~) >>> rpm -qlp python-perf-2.6.32-431.el6.centos.plus.x86_64.rpm
/usr/lib64/python2.6/site-packages
/usr/lib64/python2.6/site-packages/perf-0.1-py2.6.egg-info
/usr/lib64/python2.6/site-packages/perf.so

Additional Links for working with rpm:
15 Examples to Install, Uninstall, Upgrade, Query RPM Packages
20 Practical Examples of RPM Commands in Linux