RPM code is used for Linux like operating system ( RHEL , Centos ,Fedora) to build,query,install,update,verify and erase individual software packages.RPM package also contains detailed information about the package version modification,release date,depends on etc.Local rpm package database is stored at /var/lib/rpm ,contains information about file attributes and package dependencies.
Below I have listed some RPM commands used on day to day basis in Linux.
RPM file format: name-version-release.architecture.rpm
Below I have listed some RPM commands used on day to day basis in Linux.
RPM file format: name-version-release.architecture.rpm
a) Command to install rpm package
# rpm –ivh package name
-i : install
a package
-v : verbose output
-h: print hash marks as the package archive is unpacked.
-v : verbose output
-h: print hash marks as the package archive is unpacked.
b) Command to install package without dependency
# rpm -ivh package name
- - nodeps
c) Command to install package with dependency
#rpm -ivh package name - - aid
d) Command to install a package forcefully
# rpm -ivh package name - - force
e) Command to upgrade a package
# rpm –Uvh package name
While upgrading ,original package(with exception of
configuration files ) on the system will be removed and new packages will be installed.
Configuration files from the original installation are saved with a “.rpmsave”
extension.
f) Command to view all installed packages
# rpm –qa | less
g) Command to uninstall a rpm
# rpm –e package name
# rpm –ev - - nodeps
package name
h) Command to check whether a particular rpm(vsftpd) is installed or
not
#rpm –qa vsftpd*
i) Command to view document file for a particular rpm
#rpm –qd package name
j) Command to view configuration file for a particular rpm
# rpm –qc package name
k) Command to find the package name for a particular file name
# rpm –qf path to
file
l) Command to view the information about the installed rpm package
# rpm –qi package name
m) Command to view the list of recently installed rpm
# rpm -qa --last |
less
n) Command to view the dependency of rpm before installation
# rpm –qRp package
name
o) Command to verify a installed package against rpm database
# rpm -Vp package
name
To verify all packages installed
# rpm –Va
p) Command to import RPM GPG keys
# rpm - - import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 [Press
tab to complete]
q) Command to view all RPM imported GPG keys
# rpm –qa gpg-pubkey*
r) Command to rebuild corrupted RPM database
#cd /var/lib/rpm
#rm __db*
#rpm –rebuilddb
# /usr/lib/rpm/rpmdb_verify Packages