Package Management in Red Hat

Red Hat’s Package Manager (RPM)

RPM is a powerful software manager. It can install, remove, query, and verify the software on your system. Rpm is more than a Red Hat specific tool. Many other modern distributions, such as Caldera and SuSe, use rpm too.

Querying Your System

The first thing you should do is look and see what software you have installed on your system. Here is the command to use:

        rpm -qa | more

 

NOTE: – The package info is split into three pieces. The first piece is the package name. The second is the software version number. And, the third is the package build number. All three are separated by dashes.

Suppose you query all the packages in your system and see faq-5.0-2. What is it and how can you find out more info? We can query individual packages like this:

        rpm -qi faq
The i query option requires a package name. Now that you know what the faq package is, can you see which files it installed on your system? Absolutely! 
        rpm -ql faq

Installing New Software

To add new software:

              rpm -ivh xsnow-1.40-5.i386.rpm

The -i is the install switch. I like to use the v for verbose messages in case if the installation fails. The h option shows our progress with hash marks. If nothing else, it entertains you while your package is installed.

The upgrade syntax is exactly the same as an install, but you replace the -i with a –U

 
        rpm -Uvh xsnow-2.0-1.i386.rpm

 NOTE: – Some packages, like man pages, will have noarch in the file name. It means that the package is not dependant on the kind of CPU you have.

Removing Unwanted Software

A major advantage to a packaging system like rpm is its ease to erase software. Here is how you do it:

               rpm -e faq

Verifying Installed Packages

Verifying a package compares information about the installed files in the package with information about the files taken from the original package and stored in the rpm database. Among other things, verifying compares the size, MD5 sum, permissions, type, owner, and group of each file.

 
        rpm -Va

Good Notes:-

Sometimes a package is not removed cleanly. Here is the situation, you try to install something and rpm says its already installed. You then try to remove it, and rpm says that is not installed. What can you do?

        rpm -ivh --force package-1.0-5.i386.rpm

The –force option is your solution.

Adding and Removing RPM Packages with yum:-

The rpm command may not install the package if there are dependencies, in that time you have to download and install all dependencies before installing that package OR you can use yum to automatically download and install dependencies with the package.

Now if you need to install vsftpd package and all its dependencies with one command you can

        yum install vsftpd
Yum will search configured repositories and download the package along with its dependencies. 

Packages can be removed just as easily as they can be added. To remove the vsftpd package that we just installed

        yum erase vsftpd

This will remove a package and its dependencies (if not used anymore) from the system

To know more about yum click here.

Additional Resources

Advertisements