RPM command with examples in Linux / Unix

RPM command with examples in Linux / Unix

The abbreviation of RPM is Redhat Package Manager. Their are 3 ways to install a package in linux they are

1.Yellow dog update manager(YUM),

2. Redhat Package Manager(RPM) and

3. Tape Archiver(TAR).

RPM commmand with examples in linux / Unix

We have already seen how to install and configure Yum Server now we are going to see how to use RPM command in linux / Unix with examples.

Before going deep about the rpm command lets see some thing about its options.

Options:

-i|–install, -V|–verify, -q|–query, -a,–all, -U|Upgrade, -h|–hash, -i,–info, -l,–list, -f,–file FILE,-l,–list , -p,–package PACKAGE_FILE, -e|–erase, -v| verbose

How to install a RPM package in linux / Unix

Syntax:
#rpm -ivh <RPM package>

Example command::
#rpm -ivh vsftpd-2.0.5-28.el5.i386.rpm

RPM commmand with examples in linux / Unix

 

How to view all installed rpm in Linux / Unix

Syntax:
#rpm -qa

Example command:
#rpm -qa

RPM commmand with examples in linux / Unix

 

How to find the installed vsftpd package in Linux / Unix

Example command:
#rpm -qa | grep -i vsfptd

How to upgrade a existing rpm package in Linux / Unix

Syntax:
#rpm -Uvh <RPM package>

Example command:
#rpm -Uvh vsftpd-3.0.2-1.el5.i386.rpm

Then verify that the vsftpd PRM package is updated or not using below command
Example command:
#rpm -qa | grep -i vsfptd

RPM commmand with examples in linux / Unix

 

How to delete or remove a installed rpm package in Linux / Unix

Syntax:
#rpm -e <RPM package>

Example Command:
#rpm -e vsftpd-3.0.2-1.el5

RPM commmand with examples in linux / Unix

 

How to find the installed RPM nane from a file or folder.

Consider a scenario that i am having a folder name /etc/httpd and i want to find from which RPM package it is installed. To do that use the below command.

Syntax
#rpm -qf <folder or file name>

Example
#rpm -qf /etc/httpd

RPM commmand with examples in linux / Unix

 

How to install a rpm package even if you are facing dependency issue

Syntax:
#rpm -ivh <rpm package> –nodeps

#rpm -ivh rpmforge-release-0.3.5-1.el4.rf.i386.rpm –nodeps

 

Query installed package

===================

Find rpm files installed by date

Syntax:
#rpm -qa –last

Example command:
#rpm -qa –last

 

Find configuration files available inside an installed RPM package

Syntax:
#rpm -qc <rpm package>

Example command:
#rpm -qc httpd-2.2.3-65.el5_8

RPM commmand with examples in linux / Unix

 

Find dependency of an rpm package

Syntax:
#rpm -qR <rpm package>

Example Command:
#rpm -qR httpd-2.2.3-65.el5_8

 

Find the files listed inside a installed rpm package in Linux / Unix

Syntax:
#rpm -ql <rpm package>

Example Command:
#rpm -ql httpd-2.2.3-65.el5_8

RPM commmand with examples in linux / Unix

 

How to find full information about an installed rpm package in Linux / Unix

Syntax:
#rpm -i <rpm package>

Example Command:
#rpm -qi vsftpd-3.0.2-1.el5

 

How to list all document files inside an rpm package in Linux / Unix

Syntax:
#rpm -d <rpm package>

Example Command:
#rpm -qd httpd-2.2.3-65.el5_8

 

 

Query Non-Installed RPM package

============================

 

Find configuration files available inside an non-installed RPM package

#rpm -qpc httpd-2.2.3-65.el5_8Find dependency of an rpm package#rpm -qpR httpd-2.2.3-65.el5_8

 

Find the files listed inside a non-installed rpm package in Linux / Unix

#rpm -qpl httpd-2.2.3-65.el5_8

 

How to find full information about an non-installed rpm package in Linux / Unix

#rpm -qpi httpd-2.2.3-65.el5_8

 

How to list all document files inside anĀ  rpm package in Linux / Unix

#rpm -qpd httpd-2.2.3-65.el5_8

 

The Database of the installed rpm packages are listed in the below location

#ls -l /var/lib/rpm

To know more about rpm command use the below command

#man rpm

#help rpm

#info rpm




Leave a Reply

Your email address will not be published. Required fields are marked *