How to install the packages in Redhat Linux?

Introduction:
In this tutorial, we are going to learn about how to install, uninstall, modify and update the individual packages in Redhat servers by using the rpm utility.
To install the packages in Redhat based systems we have two powerful tools to perform that,
1)RPM(RedHat Package manager)
2)YUM(Yellow Dog Updatemodifier)

Rpm(Redhat package manager):
The RedHat package manager is a powerful tool for the Redhat based systems like Fedora, Centos, Redhat.It allows the user to install, uninstall, upgrade, modify the packages on the Unix/Linux servers.
  • Basically, Rpm tool works directly with the packages and it will not check and install the dependency packages, Some application might depend on other packages, when you are using rpm to install that first, you need to install the dependency packages manually, then after that, you have to install the main package.In order to work an application properly, we need to install all the chain dependencies packages.
YUM:
Yum works in a different way to install, uninstall and upgrade the  Red Hat packages.It works with the package repositories where all the information about the packages gets stored.By default yum tool automatically check all the dependency packages and install them, When you are using rpm, you no need find and check for the dependencies packages and install them one by one manually, yum does all the works automatically.In order to run yum command We need to configure the YUM package repositories first on your Linux system (I will explain how to configure yum repositories in our next article)
Note:
So the main difference between the rpm and yum tool is rpm will not install the dependencies packages whereas yum will check and install all the required dependencies packages.
Note:
RPM Earlier called as the .rpm file it contains the software programs and libraries that are needed by the packages.And this tool works only with the packages that built in the .rpm format.
RPM packages Details:
It is very important to know about the rpm package file name conventions on Linux package management.By default, all the package includes the version number, hardware architecture and many more details.Let us see the package names along with the details
First, change your working directory path to the /media where the CD-ROM gets mounted.
#cd /media/RHEL_5.7\x86_64\DVD/Server/
This is the path where the rpm packages reside on CD-ROM(on RHEL5.7)

Note:
In RHEL 6.0 the path for the rpm packages are under /media/RHEL_6.0\x86_64\DVD/Packages
Now run the command to list all the available .rpm packages from the CD-ROM
#ls  -l

From the above output, you will see all the .rpm packages from the CD-ROM.
To check the individual package details run the below command(here I use telnet package)
#ls  -l    |grep  telnet

The above output shows the details of the telnet package.

Installing the packages:
The following Procedure to be followed before you install the packages on Linux server.
1)Always check the integrity of the package before you install
2)Check whether the package is already installed on your server
3)If the package is not installed then use the rpm command to install the packages
4)After installation check whether it gets updated on the Linux Package Management.
Ex:1 How to install the Packages on Redhat servers?
Insert the CD-ROM media in to the drive, once the media gets mounted on its mount point directory change your path to that mount point directory
Check whether the CD-ROM is mounted or not,
#df -h

As you can see from the output the cdrom is mounted on the mount point directory /media
/media  – It is default mount point directory for the removable media.
Now change your path to the directory where the packages reside.
#cd  /media/RHEL_5.7\x86_64\ DVD/Server/
Run the “ls” command to check all the available packages from cdrom
In  this example, I will show you how to install nano package .(nano is an editor tool)
Check nano package is listed in CDROM
#ls  nan (then press the tab key twice it will list the package details if it is avaiable)

Once you have confirmed the nano package is available in CD-ROM you can now start to install the package,
Check Whether the nano package is installed on the server or not?
syntax:
#rpm    <options>   <package name>
Options:
-q   -To query
-a  -To print all the installed packages in the system
-R  -To list all the dependent packages
-e   -To uninstall the installed package from the system
-v  – Verbose output
-U -To update the existing installed package
-h – To show the hash progress(display the progress in hash on your screen)
#rpm  -q   nano

From the above output, nothing displayed which confirmed the nano package is not installed on the system, if the package is installed already on the system then it would display the package details.
Make sure you are under the   /media/RHEL_5.7\x86_64\ DVD/Server/
#pwd
Now install the package
#rpm  -ivh    nano-1.3.12-1.1.x86_64.rpm

Now confirm whether the nano package is successfully installed on the system or not,
#rpm  -q   nano

The above output displays the package details(nano), which confirmed the package is successfully installed on the system.
Ex:2 How to uninstall the package from the system?
The same command we have to use it with the option  -e
#rpm  -e  nano

Run the query command to confirm whether the package is uninstalled successfully
#rpm  -q nano
The above output shows the nano package was successfully uninstalled.
Ex:3 How to check the integrity of the package?
Always check the integrity of the package on Linux system before you install them and make sure always the test result gives you ok.
In this example, I will show you how to do the integrity check for a package.
#rpm  --checksig  <package name>
–checksig means Check signature
#rpm  --checksig  pinfo-0.6.9-1.fc6.x86_64.rpm

The output says the package integrity check was not ok i.e, the package has some missing keys.
Note:
If the package has passed the test then it would display as md5 OK
Ex:4 How to check the dependencies of the package?
Checking the dependencies of the package is very important for the system administrator before he installs the package, as you know the rpm tool will not install the dependencies packages, if you haven’t installed the dependencies packages then it will not allow you to install the mentioned package.Do a check about the dependency packages that are needed for the package you are going to install.
#rpm  -qpR   httpd-2.2.3-53.el5.x86_64.rpm
-q –>To query
-p –>Prints the capabilities package provides
-R –>Will print on which this package depends.

The above output prints all the dependent packages that needed by the httpd package, so if you want to install this httpd package with rpm command, first you need to install all the dependent packages one by one manually.
Ex:5 How to install a package without dependencies?
In some case we need to install the package without the need for dependency packages, on that time we can use the special option –nodeps with the rpm command to install it without dependency packages.
#rpm  -ivh  --nodeps  <packagename>
#rpm  -ivh  --nodeps    httpd-2.2.3-53.el5.x86_64.rpm

From the above output, the httpd package was installed without the need for its dependent packages
Ex:6 How to check the latest installed packages information along with the date and time details?
To get the latest installed packages information use the special option –last with the rpm command as follows
#rpm  -qa  --last

The above output shows the installed package details along with Date, time and year details.
Ex:7 How to Upgrade the already installed package on your system?
Use the -U option with the rpm command to upgrade an existing package in your system,The benefit of using this option is, it not only upgrade the existing package but also it takes a backup of the package older version so that in case if the updated version is not working properly then it uses the older version of the backup.
#rpm  -Uvh   nano-1.3.12-1.1.x86_64.rpm

Ex:8 How to check the command belongs to which package?
If you want to check the command belongs to which package in your Linux system we can get that with the rpm, let us say for an example I need to find  the command “top” belongs to which package, Run the following command to get the package details
#rpm -af   <full path to the command>
To print, the full path of the command run the following command,
#which  top

#rpm  -qf  /usr/bin/top

From the above output, the top command belongs to the package procps-3.2.7-17.e15
Ex:9 Check the package details after installed?
Suppose  if you want to check the details of the installed package about the release number, size,  signature key, vendor and much more run the following command
#rpm  -qi  <package name>
qi means (Query info)
#rpm -qi   telnet

From the above output, you would see the entire details about the telnet package.
Ex:10 How to get the information about the package before you install?
Sometimes we may need the internet to download some of the rpm packages to install, after downloading the package if we want to check the details of the package  to know about the author and some other details run the following command
Note:
I have downloaded the rpm package from the internet babel-0.9.5-1.el5.rf.noarch.rpm and I have saved inside the folder /rpm.
#rpm  -qip  <packagename>
-p  -this option allows us to perform the same query analysis on the package which is not installed on the system.
#cd  /rpm
#ls

Now check the details of this downloaded package,
#rpm  -qip babel-0.9.5-1.el5.rf.noarch.rpm

From the above output, you would see the details of the package (which is downloaded from internet).
In our next article, I will explain about the yum repositories in Redhat systems.
Never miss any article from this blog ,Kindly do like my FB page   Learn Linux in a easier way

*************************************************************************************************************************************

If you found this article useful, Kindly Subscribe and do share it with your friends, Thank you🙂🙂

[rainmaker_form id=”235″]

 

 

 

 

About Author:

Hello readers! Let me introduce my self first. My name is Vasanth Nirmal Singh J S having 9+ years of experience in IT on all flavours of Unix operating systems ,Storage's and many more .. I would like to share my technical experience i have come across - can be help to other people. So in this blog, I'll post my thoughts related to ITIS. I'll share experiences that I've had while working in different environments. You can expect content related to Unix,Solaris,Linux,EMC Storeages,HP-UX and many others. I hope this blog can be useful for you! Your comments will be appreciated!

0 thoughts on “How to install the packages in Redhat Linux?

Leave a Reply

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