Most RPM Related Commands for linux :-

RPM:- RPM stands for Redhat Package Manager.
This command is used for Installation, remove, and upgrade the packages.
And RPM Command is used for queries also, like Information about the installed rpm, what are all rpms are installed on my system or Server.
Some Examples of rpm related commands are as follows.

1. Install RPM Package:-
RPM has the name format like 1. Package name (test) 2. Version (3.0), Release (5) & bit of the rpm like 64 or 32 (i386).
Here I am using test RPM as an example “test-3.0-5.i386.rpm”.
# rpm -ivh test-3.0-5.i386.rpm, (I=Install a package, v=Verbose, h=Prints the hash)

2. Upgrade RPM Package:-
In this step older version of the rpm automatically un-installs and installs the newer version of the rpm.
# rpm -Uvh test-3.0-5.i386.rpm, (U=Upgrade)

3. Check All Installed RPMs:-
Using query option with rpm command we can Check, what are all the packages installed on our system.
# rpm -qa, (q=query, a=all installed packages),
And also we can check particular rpm package is installed or not, If it is installed which version is installed.
# rpm -qa |grep test (test=package name)

4. Un-Install RPM Packages:-
To un-install package of RPM need to know the package name, In `rpm -qa |grep test` this command you will get package name of the test as output.
# rpm -e test-3.0-5 (test=package name)

5. Information of installed RPM & Before installing RPM check the details of the RPM:-
Detailed Information of the Installed RPM like Name, Version, Installed Date, Size And Summary.
# rpm -qi test
If you want to know more details of rpm before installing you can do as follows,
# rpm -qip test-3.0-5.i386.rpm (i=information of the rpm, p = package name)

6. Check the dependency of the package:-
Before installing the rpm you can check the packages dependent on this rpm using “rpm -qRp“
# rpm -qRp test-3.0-5.i386.rpm (R=List capabilities on which this package depends)

7. Which file belongs to which RPM by using “rpm -qf”:-
Suppose you want to know the rpm of bash command then find the where is the bash file by following command.
# which bash
# rpm -qf /bin/sh
If you know the file then directly use the “rpm -qf /file/path” to know the rpm of the file.

8. Want to know what are all files are there in rpm use this command “rpm -qlp package name“:-
# rpm -qlp test-3.0-5.i386.rpm (l=list all files in the rpm) (p = Package name)
If you want to know all file location of installed rpm
# rpm -ql bash-4.1.2-14.el6.x86_64
Only for Configuration files
# rpm -qc bash-4.1.2-14.el6.x86_64
Only for doc files (For Man pages)
# rpm -qd bash-4.1.2-14.el6.x86_64

9. Install or remove RPM by Without checking the dependency:-
With using “–nodeps” Install or Un-installation of the rpm, it will not check the dependency for that.
# rpm -ivh test-3.0-5.i386.rpm –nodeps or
# rpm -e bash-4.1.2-14.el6.x86_64 –nodeps

10.TO check recently installed RPPMs:-
# rpm -qa –last (–last = displays the recently installed rpms)

11.Replace the RPM if you already Installed:-
In some cases the rpm is crashed or damaged, on that time you are not able to install the rpm.
At this case we can use “–replacepkgs“
# rpm -ivv –replacepkgs test-3.0-5.i386.rpm (vv = will show the more inner working of the rpm details while installing the RPM)
The original package was replaced by a new copy of itself.

12.Install RPM in different path:-
Normally when you will install rpm, it will install under /usr/local.
Now you want to install in a different directory then we can use “–prefix“
# rpm -iv –prefix /tmp/soft/ test-3.0-5.i386.rpm
In above command we are installing test rpm under /tmp/soft/ Dir.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: