Walker News

Some Examples Of Linux RPM Command Usage

Not all Linux distributions are using RPM, but Redhat and Fedora Linux are certainly using RPM for package management system.

Instead of covering RPM in detail, here are only some commonly used examples of RPM command based on RHEL 5 (could be useful for most Linux administrators):

To install or upgrade RPM package on Linux:
rpm -Uvh sample.rpm

NOTE: the “-U” works like “-i” except that it will also remove old version of the package installed previously.

Instead of installing the package, you can also simulate or test the RPM package installation (to find out potential conflicts, errors, or kind of):
rpm -Uvh --test sample.rpm

To erase or uninstall the RPM package, uses “-qa” to get the installed package name for “-e” option. For example, to remove sharutils package:
[walker@localhost]# rpm -qa | grep sharutils
sharutils-4.6.1-2
[walker@localhost]# rpm -e sharutils-4.6.1-2
[walker@localhost]# rpm -qa | grep sharutils
[walker@localhost]# 

Similarly, you can test the package uninstallation process to find out potential conflicts:
rpm -e --test sharutils-4.6.1-2

To check or display the list of RPM package installed on Linux, ordered by installation date:
rpm -qa --last

To check or trace the list of files installed by the RPM package, you need to know the name of that installed package (using “-qa” option) before using “-ql” option. E.g.:
[walker@localhost]# rpm -qa | grep nmap
nmap-4.11-1.1
[walker@localhost]# rpm -ql nmap-4.11-1.1
/usr/bin/nmap
....(truncated output)
[walker@localhost]# 

To find out which RPM package install the file on Linux – pretty good for situation where you want find out the program or library files on a Linux system were installed by which RPM package, e.g:
[walker@localhost]# rpm -qf /etc/securetty
setup-2.5.58-1.el5

To query or check the description of an installed RPM package, uses “-qa” to find out its name before using “-qi” option (the following command output is “rearranged” for presentation):
[walker@localhost]# rpm -qa | grep nmap
nmap-4.11-1.1
[walker@localhost]# rpm -qi nmap-4.11-1.1
Name        : nmap
Relocations: (not relocatable)
Version     : 4.11                     
Vendor: Red Hat, Inc.
Release     : 1.1                   
Build Date: Thu 13 Jul 2006 01:53:46 AM PST
Install Date: Wed 12 May 2010 11:55:24 PM PST
Build Host: hs20-bc2-3.build.redhat.com
Group       : Applications/System
Source RPM: nmap-4.11-1.1.src.rpm
Size        : 2364962
License: GPL
Signature   : DSA/SHA1, Fri 19 Jan 2007 12:11:42 AM PST, Key ID 5326810137017186
Packager    : Red Hat, Inc. 
URL         : http://www.insecure.org/nmap/
Summary     : Network exploration tool and security scanner
Description:
Nmap is a utility for network exploration or security auditing. It supports ping scanning (determine which hosts are up), many port scanning techniques (determine what services the hosts are offering), and TCP/IP fingerprinting (remote host operating system identification). Nmap also offers flexible target and port specification, decoy scanning, determination of TCP sequence predictability characteristics, reverse-identd scanning, and more.

To check or display the list of files provided by the RPM package:
rpm -qlp sample.rpm

Similarly, to find out the description of the RPM package:
rpm -qip sample.rpm

For more information, type man rpm to get reference right from Linux command prompt.

Custom Search

2016  •  Privacy Policy