How To Use RPM Command in Linux With Examples
To Use RPM Command in Linux With Examples
RPM commands in Linux with examples is explained in this article. This tool allows the system administrators and users to install, update, query, verify and manage system software packages in Linux operating systems. The utility that works only with packages which built on .rpm format.
Features
- RPM is required to install packages under Linux systems.
- RPM deals only with .rpm files that contains the actual information.
- RPM is free which released under GPL (General Public License).
- RPM keeps the installed packages information under /var/lib/rpm database.
Basic modes for RPM command
Verify | To query about different RPM packages. |
Query | For the verification of any RPM package. |
Install | To install any RPM package. |
Remove | To erase, remove or un-install any RPM package. |
Upgrade | To update the existing RPM package. |
To Check an RPM Signature Package
Before installing, check the PGP signature of packages on Linux systems and ensure the integrity and origin. Check the signature of a package called pidgin by running the following command with --checksig option.
[root@linuxhelp ~]# rpm --checksig pidgin-2.7.9-27.el6.x86_64.rpm
pidgin-2.7.9-27.el6.x86_64.rpm: rsa sha1 (md5) pgp md5 OK
To Install an RPM Package
Use the following command with -i option to install an rpm software package.
[root@linuxhelp ~]# rpm -ivh pidgin-2.7.9-27.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:pidgin ########################################### [100%]
Command and options of RPM
-h : To print hash marks as the package archive is unpacked.
-i : To install a package
-v : To verbose for a nicer display
To check an Installed RPM Package
Use -q option with package name to show that package is installed or not.
[root@linuxhelp ~]# rpm -q pidgin
pidgin-2.7.9-27.el6.x86_64
To List all files of an installed RPM package
Run the -ql option with rpm command to view all the installed packages.
[root@linuxhelp ~]# rpm -ql pidgin
/etc/gconf/schemas/purple.schemas
/usr/bin/gaim
/usr/bin/pidgin
/usr/lib64/pidgin
/usr/lib64/pidgin/convcolors.so
/usr/lib64/pidgin/extplacement.so
/usr/lib64/pidgin/gestures.so
/usr/lib64/pidgin/gevolution.so
/usr/lib64/pidgin/gtkbuddynote.so
/usr/lib64/pidgin/history.so
/usr/lib64/pidgin/iconaway.so
/usr/lib64/pidgin/markerline.so
.
.
.
/usr/share/pixmaps/pidgin/tray/hicolor/48x48/status/pidgin-tray-pending.png
/usr/share/pixmaps/pidgin/tray/hicolor/48x48/status/pidgin-tray-xa.png
/usr/share/pixmaps/pidgin/tray/hicolor/index.theme
To Query a Information of Installed RPM Package
Run the following -qi (query info) option, which will print the information of installed package.
[root@linuxhelp ~]# rpm -qi pidgin
Name : pidgin Relocations: (not relocatable)
Version : 2.7.9 Vendor: CentOS
Release : 27.el6 Build Date: Wed 05 Feb 2014 11:47:15 PM IST
Install Date: Thu 16 Jun 2016 11:25:27 AM IST Build Host: c6b10.bsys.dev.centos.org
Group : Applications/Internet Source RPM: pidgin-2.7.9-27.el6.src.rpm
Size : 3142033 License: GPLv2+ and GPLv2 and MIT
Signature : RSA/SHA1, Thu 06 Feb 2014 01:13:36 AM IST, Key ID 0946fca2c105b9de
Packager : CentOS BuildSystem < http://bugs.centos.org>
URL : http://pidgin.im/
Summary : A Gtk+ based multiprotocol instant messaging client
Description :
Pidgin allows you to talk to anyone using a variety of messaging protocols including AIM, MSN, Yahoo!, Jabber, Bonjour, Gadu-Gadu,
ICQ, IRC, Novell Groupwise, QQ, Lotus Sametime, SILC, Simple and Zephyr. These protocols are implemented using a modular, easy to
use design. To use a protocol, just add an account using the account editor.
Pidgin supports many common features of other clients, as well as many
unique features, such as perl scripting, TCL scripting and C plugins.
Pidgin is not affiliated with or endorsed by America Online, Inc.,
Microsoft Corporation, Yahoo! Inc., or ICQ Inc.
To List Recently Installed RPM Packages
Run the rpm command with -qa option to list all the recently installed rpm packages.
[root@linuxhelp ~]# rpm -qa --last
pidgin-2.7.9-27.el6.x86_64 Thu 16 Jun 2016 10:08:57 AM IST
jre1.8.0_91-1.8.0_91-fcs.x86_64 Wed 15 Jun 2016 06:05:15 PM IST
squid-3.1.23-16.el6_8.4.x86_64 Sat 04 Jun 2016 03:43:08 PM IST
wget-1.12-8.el6.x86_64 Sat 04 Jun 2016 10:16:48 AM IST
php-soap-5.3.3-47.el6.x86_64 Sat 04 Jun 2016 10:16:44 AM IST
php-ldap-5.3.3-47.el6.x86_64 Sat 04 Jun 2016 10:16:44 AM IST
php-xml-5.3.3-47.el6.x86_64 Sat 04 Jun 2016 10:16:43 AM IST
php-xmlrpc-5.3.3-47.el6.x86_64 Sat 04 Jun 2016 10:16:42 AM IST
php-gd-5.3.3-47.el6.x86_64 Sat 04 Jun 2016 10:16:41 AM IST
php-odbc-5.3.3-47.el6.x86_64 Sat 04 Jun 2016 10:16:40 AM IST
php-mysql-5.3.3-47.el6.x86_64 Sat 04 Jun 2016 10:16:40 AM IST
.
.
.
m17n-db-1.5.5-1.1.el6.noarch Wed 30 Mar 2016 05:49:57 PM IST
libgcc-4.4.7-16.el6.x86_64 Wed 30 Mar 2016 05:49:57 PM IST
fontpackages-filesystem-1.41-1.1.el6.noarch Wed 30 Mar 2016 05:49:57 PM IST
gpg-pubkey-c105b9de-4e0fd3a3 Wed 30 Mar 2016 05:41:48 PM IST
To List All Installed RPM Packages
To print the names of an installed packages on the Linux system, run the below command.
[root@linuxhelp ~]# rpm -qa
cups-libs-1.4.2-72.el6.x86_64
audispd-plugins-2.3.7-5.el6.x86_64
tftp-0.49-7.el6.x86_64
clutter-1.0.6-3.el6.x86_64
qemu-kvm-tools-0.12.1.2-2.479.el6_7.4.x86_64
perl-String-CRC32-1.4-9.el6.x86_64
perl-hivex-1.3.3-4.3.el6.x86_64
rhino-1.7-0.7.r2.2.el6.noarch
perl-Crypt-OpenSSL-RSA-0.25-10.1.el6.x86_64
paktype-tehreer-fonts-2.0-8.el6.noarch
trilead-ssh2-213-6.2.el6.noarch
.
.
.
m17n-contrib-tamil-1.1.10-4.el6_1.1.noarch
xcb-util-0.3.6-6.el6.x86_64
libgomp-4.4.7-16.el6.x86_64
memcached-1.4.4-3.el6.x86_64
unixODBC-devel-2.2.14-14.el6.x86_64
tpm-tools-1.3.4-2.el6.x86_64
To Upgrade a RPM Package
Use ' -U' (upgrade) option with rpm to upgrade any RPM package.
[root@linuxhelp ~]# rpm -Uvh pidgin-2.7.9-27.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:pidgin ########################################### [100%]
To Remove a RPM Package
Use the below command to un-install an RPM package,
[root@linuxhelp ~]# rpm -ev pidgin
To check the dependencies of RPM Package
Check the dependent packages before installing by using the following command.
[root@linuxhelp ~]# rpm -qpR pidgin-2.7.9-27.el6.x86_64.rpm
/bin/sh
/bin/sh
/bin/sh
/bin/sh
GConf2
GConf2
GConf2
glib2 > = 2.26
libICE.so.6()(64bit)
libSM.so.6()(64bit)
libX11.so.6()(64bit)
libXext.so.6()(64bit)
.
.
.
rpmlib(CompressedFileNames) < = 3.0.4-1
rpmlib(FileDigests) < = 4.6.0-1
rpmlib(PayloadFilesHavePrefix) < = 4.0-1
rpmlib(VersionedDependencies) < = 3.0.3-1
rtld(GNU_HASH)
xdg-utils
rpmlib(PayloadIsXz) < = 5.2-1
Command and options of RPM
-q : To query a package
-p : To list the capabilities of package provides.
-R : To list the capabilities of package depends.
To Install a RPM Package Without Dependencies
Run the following command to install a RPM packages without any dependencies.
[root@linuxhelp ~]# rpm -ivh --nodeps pidgin-2.7.9-27.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:pidgin ########################################### [100%]
To Remove an RPM Package Without Dependencies
Remove the rpm package from the system using the --nodeps (Do not check dependencies) option as shown below.
[root@linuxhelp ~]# rpm -ev --nodeps pidgin
To Query a file that belongs which RPM Package, run the below command.
[root@linuxhelp ~]# rpm -qf /usr/bin/htpasswd
httpd-tools-2.2.15-53.el6.centos.x86_64
To Get the Information of RPM Package Before Installing.
[root@linuxhelp ~]# rpm -qip pidgin-2.7.9-27.el6.x86_64.rpm
Name : pidgin Relocations: (not relocatable)
Version : 2.7.9 Vendor: CentOS
Release : 27.el6 Build Date: Wed 05 Feb 2014 11:47:15 PM IST
Install Date: (not installed) Build Host: c6b10.bsys.dev.centos.org
Group : Applications/Internet Source RPM: pidgin-2.7.9-27.el6.src.rpm
Size : 3142033 License: GPLv2+ and GPLv2 and MIT
Signature : RSA/SHA1, Thu 06 Feb 2014 01:13:36 AM IST, Key ID 0946fca2c105b9de
Packager : CentOS BuildSystem < http://bugs.centos.org>
URL : http://pidgin.im/
Summary : A Gtk+ based multiprotocol instant messaging client
Description :
Pidgin allows you to talk to anyone using a variety of messaging
protocols including AIM, MSN, Yahoo!, Jabber, Bonjour, Gadu-Gadu,
ICQ, IRC, Novell Groupwise, QQ, Lotus Sametime, SILC, Simple and
Zephyr. These protocols are implemented using a modular, easy to
use design. To use a protocol, just add an account using the
account editor.
Pidgin supports many common features of other clients, as well as many
unique features, such as perl scripting, TCL scripting and C plugins.
Pidgin is not affiliated with or endorsed by America Online, Inc.,
Microsoft Corporation, Yahoo! Inc., or ICQ Inc.
To Query the documentation of Installed RPM Package, use the following command with option -qdf (query document file) to get the list of available installed package.
[root@linuxhelp ~]# rpm -qdf /usr/bin/vmstat
/usr/share/doc/procps-3.2.8/BUGS
/usr/share/doc/procps-3.2.8/COPYING
/usr/share/doc/procps-3.2.8/COPYING.LIB
/usr/share/doc/procps-3.2.8/FAQ
/usr/share/doc/procps-3.2.8/NEWS
/usr/share/doc/procps-3.2.8/TODO
/usr/share/man/man1/free.1.gz
. . .
. . .
/usr/share/man/man8/sysctl.8.gz
/usr/share/man/man8/vmstat.8.gz
To Verify a RPM Package, use the -Vp (verify package) option to verify a package information that compared to the installed package files against the rpm DB.
[root@linuxhelp ~]# rpm -Vp sqlbuddy-1.3.3-1.noarch.rpm
missing /etc/httpd/conf.d/sqlbuddy.conf
missing /etc/sqlbuddy
missing /usr/share/sqlbuddy
missing /usr/share/sqlbuddy/LICENSE
missing /usr/share/sqlbuddy/README
missing /usr/share/sqlbuddy/ajaxcreatetable.php
missing /usr/share/sqlbuddy/ajaxfulltext.php
missing /usr/share/sqlbuddy/ajaximportfile.php
missing /usr/share/sqlbuddy/ajaxquery.php
.
.
.
missing /usr/share/sqlbuddy/themes/classic/images/shading.png
missing /usr/share/sqlbuddy/users.php
To verify all the installed rpm packages, use the following command.
[root@linuxhelp ~]# rpm -Va
S.5....T. c /etc/odbcinst.ini
S.5....T. c /etc/maven/maven2-depmap.xml
..5....T. c /etc/inittab
S.5....T. c /etc/printcap
.......T. /var/log/tomcat6/catalina.out
S.5....T. c /etc/pulse/default.pa
S.5....T. c /etc/updatedb.conf
.....U... /var/lib/Pegasus/repository/root#PG_InterOp/instances/PG_Provider.idx
.....U... /var/lib/Pegasus/repository/root#PG_InterOp/instances/PG_ProviderCapabilities.idx
.....U... /var/lib/Pegasus/repository/root#PG_InterOp/instances/PG_ProviderModule.idx
To Import an RPM GPG key
Import the GPG key in order to verify RHEL/CentOS/Fedora packages. Use the following command to import CentOS GPG key.
[root@linuxhelp ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
List all Imported RPM GPG keys, use the following command, to print all the imported GPG keys in the system.
[root@linuxhelp ~]# rpm -qa gpg-pubkey*
gpg-pubkey-5072e1f5-4e773e2a
gpg-pubkey-c105b9de-4e0fd3a3
Comments ( 0 )
No comments available