RPM - RedHad Package Manager is a very popular utility for uninstalling packages on Unix / Linux systems, most of we are using on CentOS, Red Hat, Fedora, etc. The "rpm command" usages are installing, removing, upgrading, querying, checking rpm packages on your system.
The following is an examples are how to use rpm packages.
Login as root user,
Installation:
How to Install ,rpm Package:
Download the rpm package and install on your system, for an example dowload the JDK .rpm package.
# wget "http://download.oracle.com/otn-pub/java/jdk/7u60-b19/jdk-7u60-linux-x64.rpm"
# rpm -ivh jdk-7u60-linux-x64.rpm
# rpm -ivh jdk-7u60-linux-x64.rpm
-i : install a package
-v : verbose
-h: Print hash marks as the package during install can Use with --verbose for display.
Install without dependency:
If you know very well dependencies installed in your system ignore these dependency with --nodeps,
# rpm -ivh --nodeps jdk-7u60-linux-x64.rpm
Check your installed packages:
# rpm -q openssl
openssl-1.0.1e-30.el6.8.x86_64
Query :
Display RPM package,
To disaplay installed rpm packages from the system.
# rpm -qa
glib2-2.12.3-2.fc6
mktemp-1.5-23.2.2
bzip2-libs-1.0.3-3
...
-q : specify for query operation
-a : specify for queries all installed packages
Identify at a specifc package:
To identify and display specific installed package,
# rpm -qa | grep openssl
openssl-1.0.1e-30.el6.8.x86_64
openssl-devel-1.0.1e-30.el6.8.x86_64
Package Information:
below command shows specific package information (openssl)
# rpm -qi openss
Name : openssl Relocations: (not relocatable)
Version : 1.0.1e Vendor: CentOS
Release : 30.el6.8 Build Date: Wednesday 01
April 2015 06:59:29 PM IST
Install Date: Wednesday 22 April 2015 08:29:29 PM IST Build Host:
c6b9.bsys.dev.centos.org
Group : System Environment/Libraries Source RPM:
openssl-1.0.1e-30.el6.8.src.rpm
Size : 4222198 License: OpenSSL
Signature : RSA/SHA1, Wednesday 01 April 2015 07:02:01 PM IST, Key
ID 0946fca2c105b9de
Packager : CentOS BuildSystem
URL : http://www.openssl.org/
Summary : A general purpose cryptography library with TLS implementation
Description :
The OpenSSL toolkit provides support for secure communications between
machines. OpenSSL includes a certificate management tool and shared
libraries which provide various cryptographic algorithms and
protocols.
Package Information Before Installation:
Also, we can get package information before installation on your system,
# rpm -qip bc-1.06-21.i386.rpm
warning: bc-1.06-21.i386.rpm: Header V3 DSA/SHA1 Signature, key ID
e8562897: NOKEY
Name : bc Relocations: (not relocatable)
Version : 1.06 Vendor: CentOS
Release : 21 Build Date: Tuesday 30
January 2007 07:37:54 PM IST
Install Date: (not installed) Build Host: builder4.centos.org
Group : Applications/Engineering Source RPM: bc-1.06-21.src.rpm
Size : 187904 License: GPL
Signature : DSA/SHA1, Wednesday 04 April 2007 05:50:21 AM IST, Key
ID a8a447dce8562897
URL : http://www.gnu.org/software/bc/
Summary : GNU's bc (a numeric processing language) and dc (a calculator).
Description :
The bc package includes bc and dc. Bc is an arbitrary precision
numeric processing arithmetic language. Dc is an interactive
arbitrary precision stack based calculator, which can be used as a
text mode calculator.
Install the bc package if you need its number handling capabilities or
if you would like to use its text mode calculator.
-i : Specify for view information about an rpm
-p : specify a package name
How to Query documentation of Installed RPM Package:
# rpm -qdf /usr/bin/openssl
/usr/share/doc/openssl-1.0.1e/CHANGES
/usr/share/doc/openssl-1.0.1e/FAQ
/usr/share/doc/openssl-1.0.1e/INSTALL
/usr/share/doc/openssl-1.0.1e/LICENSE
/usr/share/doc/openssl-1.0.1e/NEWS
/usr/share/doc/openssl-1.0.1e/README
List of package files :
The below command show list out the files without installing into the local directory folder.
# rpm -qlp bc-1.06-21.i386.rpm
warning: bc-1.06-21.i386.rpm: Header V3 DSA/SHA1 Signature, key ID
e8562897: NOKEY
/usr/bin/bc
/usr/bin/dc
/usr/share/doc/bc-1.06
/usr/share/doc/bc-1.06/AUTHORS
/usr/share/doc/bc-1.06/COPYING
/usr/share/doc/bc-1.06/COPYING.LIB
/usr/share/doc/bc-1.06/FAQ
/usr/share/doc/bc-1.06/NEWS
/usr/share/doc/bc-1.06/README
/usr/share/info/bc.info.gz
/usr/share/info/dc.info.gz
/usr/share/man/man1/bc.1.gz
/usr/share/man/man1/dc.1.gz
q : specify to query the rpm file
l : specifiy to list the files in the package
p : specify the package name
Shows Dependency Packages:
# rpm -qRp bc-1.06-21.i386.rpm
warning: bc-1.06-21.i386.rpm: Header V3 DSA/SHA1 Signature, key ID
e8562897: NOKEY
/bin/sh
/bin/sh
/sbin/install-info
grep
libc.so.6
libc.so.6(GLIBC_2.0)
libc.so.6(GLIBC_2.1)
libc.so.6(GLIBC_2.3)
libc.so.6(GLIBC_2.3.4)
libc.so.6(GLIBC_2.4)
libreadline.so.5
libtermcap.so.2
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rtld(GNU_HASH)
Upgrade :
Upgrade package :
Would you like to upgrade specific package use -Uvh option,
# rpm -Uvh bc-1.06-21.i386.rpm
Uninstalling :
Remove / Uninstalling package:
We can remove or uninstalling specific package and dependency package with -e option
# rpm -e openssl-1.0.1e-30.el6.8.x86_64
How To rebuild Corrupted RPM Database
# cd /var/lib
# rm __db*
# rpm --rebuilddb
# rpmdb_verify Packages
# rm __db*
# rpm --rebuilddb
# rpmdb_verify Packages
Comments (0)