Introduction & command examples of RPM Package Manager
RPM Package Manager:
RPM stands for Red hat Package Manager. It is a powerful package manager tool for Redhat, open-suse, fedora etc. RPM can be used to install, build, verify, update, query and remove individual application or software packages.
RPM is default package manager for RedHat Linux systems.
RPM are basically files which contain installable software and that package has .rpm extension or suffix.
RPM is a free tool created or developed by Redhat software.
RPM will store information about packages in a database “/var/lib/rpm”.
Advantages of RPM Package Manager:
- Straightforward program installation and uninstallation
- Automatic installation
- Ease of updating programs originally installed with RPM
- Availability of versions for most distributions of Linux
Disadvantages of RPM Package Manager:
- Distribution packages
- Architecture-specific
- Dependency
Some sites where you get RPM Packages:
- http://rpmseek.com
- http://rpmfind.net
- http://www.redhat.com
- http://freshrpms.net
- http://rpm.pbone.net
- http://dag.wieers.com
- http://rpmforge.net
- http://filewatcher.com
There are five basic options use 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 query about different RPM packages.
- Query : It is used for the verification of any RPM package.
Some Useful RPM Command Examples:
1. Install RPM Package
This command will help you to install .rpm package. One thing keeps in mind to run rpm command you must have root access on the system.
$ rpm -ivh mozilla-mail-1.7.5-17.i586.rpm
-i : install
-v : verbose
-h : print hash marks as the package archive is unpacked.
2. Upgrade package
To upgrade package just replace the “-i” option with a capital “-U”.
$ rpm -Uvh mozilla-mail-1.7.6-12.i586.rpm
3. Erase/remove/ an installed package
To remove/erase already installed package use “-e” option.
$ rpm -ev mozilla-mail
4. Erase/remove/ an installed package without checking for dependencies
$ rpm -ev --nodeps mozilla-mail
-e : erase/remove
-v : verbose
5. Display list all installed packages
To display a list of all installed packages use below command.
$ rpm -qa
$ rpm -qa | less
-q : Query a Package
-a : all
6. Display installed information along with package
This command will help to display information about the package with version and a short description.
$ rpm -qi mozilla-mail
-q : Query Package
-i : install
7. Find out what package a file belongs to.
This is a very important command which helps to find out what package own the file or what package file belongs to.
$ rpm -qf /etc/passwd
$ rpm -qf /bin/bash
-q : Query Package
8. Display list of configuration file(s) for a package
$ rpm -qc {pacakge-name}
$ rpm -qc httpd
9. Display list of configuration files for a command
$ rpm -qcf /usr/X11R6/bin/xeyes
10. Display list of all recently installed RPMs
$ rpm -qa --last | less
11. Find out what dependencies an rpm file has
$ rpm -qpR mediawiki-1.4rc1-4.i586.rpm
-q : Query a package
-p : List capabilities this package provides.
-R : List capabilities on which this package depends.
12. Find out which files are installed with any .rpm file
$ rpm -qlp mozilla-mail-1.7.6-12.i586.rpm
13. Installing package Ignoring Dependencies
$ rpm -ivh --nodeps pants.rpm
14. Verify MD5
$ rpm -k <.rpm>
15 Rebuild corrupted RPM DB
Sometimes rpm database gets corrupted and stops all the functionality of rpm and other applications on the system. So, at the time we need to rebuild the rpm database and restore it with the help of the following command.
$ cd /var/lib
$ rm __db*
$ rpm --rebuilddb
$ rpmdb_verify Packages
I hope you like the article if you find any difficulties then please do comment your queries or problem via the comment section, till then stay tuned to techthings.org for more such valuable articles.
Related Posts
About The Author
Techthings
Welcome to TechThings. I'm Prashant Thorat, a tech-blogger from Mumbai, India. I started Techthings as a passion and to share my knowledge about technologies. Here at Techthings I write about Linux technologies, Aws Cloud, Wordpress blogging and scripting knowledge. You can read more about me at About us page. Thank You :)
Red hat Package Manager is a powerful package manager tool for Redhat and its related distro to install, build, verify, update, query and remove isoftware packages. For newbes , to automate installation process its a best solution.
I have used rpm package manager lots of time in my career.l have faced trouble many times to search dependency.There should be some option for auto search and install rpm package with dependency.Otherwise adding new repository is the next solution and sometimes it will not work !!
Yes i agreed with your opinion.
COULD WE UPDATE RPM PACKAGE ITSELF ?? IF YES, HOW? IF NO,WHY?
RPM is very easy to use, but I prefer using Yum to install software as it allows automatic dependency installation and easy updates. Your guide is very useful to install a package that is not available via Yum. Otherwise, I recommend using Yum and the guide at https://www.rosehosting.com/blog/how-to-install-and-manage-software-on-centos-7/ explains how to use Yum on CentOS. Actually, I learned about how to use Yum using that guide. Thanks for sharing.