RPM (Red Hat Package Manager) is an default open source and most popular package
management utility for Red Hat based systems
like (RHEL, CentOS and Fedora). The tool allows system administrators and users to install, update, uninstall, query, verify and manage system software packages in Unix/Linux operating systems. The RPM formerly known as .rpm file, that includes compiled software programs and
libraries needed by the packages. This utility only works with packages that
built on .rpm format.
This blog provides some
useful 20 RPM command examples that might be helpful to you. With the help of these
rpm command you can managed to install, update, remove packages in your Linux
systems.
Some Facts about RPM
(RedHat Package Manager)
§
RPM is free and released under GPL (General Public License).
§
RPM keeps the information of all the
installed packages under /var/lib/rpm database.
§
RPM is the only way to install
packages under Linux systems, if you’ve installed packages using source code,
then rpm won’t manage it.
§
RPM deals with .rpm files,
which contains the actual information about the packages such as: what it is, from where it comes, dependencies info, version info etc.
There are five basic modes for RPM
command
§
Install :
It is used to install any RPM package.
§
Remove :
It is used to erase, remove or un-install any RPM package.
§
Upgrade :
It is used to update the existing RPM package.
§
Verify :
It is used to verify an RPM packages.
§
Query :
It is used query any RPM package.
1. How to Check an RPM
Signature Package
Always
check the PGP signature of packages before installing them on your Linux
systems and make sure its integrity and origin is OK. Use the following command with –checksig (check signature) option to check the signature
of a package called pidgin.
pidgin-2.7.9-5.el6.2.i686.rpm: rsa sha1 (md5) pgp md5 OK
2. How to Install an RPM Package
For
installing an rpm software package, use the following command with -i option. For example, to install an
rpm package called pidgin-2.7.9-5.el6.2.i686.rpm.
Preparing... ########################################### [100%]
1:pidgin ########################################### [100%]
RPM command and options
§
-i :
install a package
§
-v :
verbose for a nicer display
§
-h: print
hash marks as the package archive is unpacked.
3. How to check dependencies of RPM Package before Installing
Let’s
say you would like to do a dependency check before installing or upgrading a
package. For example, use the following command to check the dependencies of BitTorrent-5.2.2-1-Python2.4.noarch.rpm package.
It will display the list of dependencies of package.
/usr/bin/python2.4
python >= 2.3
python(abi) = 2.4
python-crypto >= 2.0
python-psyco
python-twisted >= 2.0
python-zopeinterface
rpmlib(CompressedFileNames) = 2.6
RPM command and options
§
-q :
Query a package
§
-p :
List capabilities this package provides.
§
-R: List
capabilities on which this package depends..
4. How to Install a RPM Package
Without Dependencies
If
you know that all needed packages are already installed and RPM is just being
stupid, you can ignore those dependencies by using the option –nodeps (no dependencies check)
before installing the package.
Preparing... ########################################### [100%]
1:BitTorrent ########################################### [100%]
The above command forcefully
install rpm package by ignoring dependencies errors, but if those dependency
files are missing, then the program will not work at all, until you install
them.
5. How to check an Installed RPM
Package
Using -q option with package name, will show
whether an rpm installed or not.
BitTorrent-5.2.2-1.noarch
6. How to List all files of an
installed RPM package
To
view all the files of an installed rpm packages, use the -ql (query list) with rpm command.
/usr/bin/bittorrent
/usr/bin/bittorrent-console
/usr/bin/bittorrent-curses
/usr/bin/bittorrent-tracker
/usr/bin/changetracker-console
/usr/bin/launchmany-console
/usr/bin/launchmany-curses
/usr/bin/maketorrent
/usr/bin/maketorrent-console
/usr/bin/torrentinfo-console
7. How to List Recently Installed RPM
Packages
Use
the following rpm command with -qa (query all) option, will list all the
recently installed rpm packages.
BitTorrent-5.2.2-1.noarch Tue 04 Dec 2012 05:14:06 PM BDT
pidgin-2.7.9-5.el6.2.i686 Tue 04 Dec 2012 05:13:51 PM BDT
cyrus-sasl-devel-2.1.23-13.el6_3.1.i686 Tue 04 Dec 2012 04:43:06 PM BDT
cyrus-sasl-2.1.23-13.el6_3.1.i686 Tue 04 Dec 2012 04:43:05 PM BDT
cyrus-sasl-md5-2.1.23-13.el6_3.1.i686 Tue 04 Dec 2012 04:43:04 PM BDT
cyrus-sasl-plain-2.1.23-13.el6_3.1.i686 Tue 04 Dec 2012 04:43:03 PM BDT
8. How to List All Installed RPM
Packages
Type the following command to
print the all the names of installed packages on your Linux system.
initscripts-9.03.31-2.el6.centos.i686
polkit-desktop-policy-0.96-2.el6_0.1.noarch
thunderbird-17.0-1.el6.remi.i686
9. How to Upgrade a RPM Package
If
we want to upgrade any RPM package “–U” (upgrade) option will be used. One of
the major advantages of using this option is that it will not only upgrade the
latest version of any package, but it will also maintain the backup of the
older package so that in case if the newer upgraded package does not run the
previously installed package can be used again.
Preparing... ########################################### [100%]
1:nx ########################################### [100%]
10. How to Remove a RPM Package
To
un-install an RPM package, for example we use the package name nx, not the original package name nx-3.5.0-2.el6.centos.i686.rpm. The -e (erase) option is used to remove
package.
[root@localhost]# rpm -evv nx
No comments:
Post a Comment