Software Management under Linux(Fedora/Redhat) – Part 2

Earlier on we had walked through managing software packages under Debian Linux. In this post we look at managing software under an RPM based Linux distro. RPM stands for Red Hat Package Manager. As the name suggest this format was developed by Redhat but now it is not confined to Redhat Linux. Now many Linux distros like OpenSUSE, Mandriva etc have incorporated the RPM format. There are many graphical utilities out there which can help you manage software on your RPM distro but as always command line will offer you total control & flexibility over the process. Let’s go ahead & learn how to manage software on an RPM linux distro. Below foobar refers to an example application. Replace it by the name of your software package.

Installing Software Packages

First you will need to get an RPM file which contains the software. Now navigate via console to the location where you have downloaded the file. Once you get to the location of the RPM file, simply issue;

# rpm – i foobar-3.4.rpm

In the above command, the ‘i’ instructs to install the specific rpm package. Do note that you will have to enter the exact file name or the command won’t work.

Upgrading Software Packages

If you need to update any software installed on your system, then you will need to issue the following command.

Software packages installed on your system can be removed by executing the following command at the console.

# rpm –e foobar

The ‘e’ stands for erase. You might have noted that during uninstallation you do not need to specify the exact file name & neither need to suffix with .rpm. Its just the package name here similar to uninstalling software via APT on Debian systems.

Other options which can be used with the above commands

Normally you would use,

#rpm –i foobar3.4.rpm

to install any application. You can add the following options to know more about the installation progress.

-v (This option will output debugging information while the package gets installed. This is helpful to debug any problems if the package doesn’t installs or installs improperly)

-percent (This will print the total installation progress in percentage during the installation process)

-h (This will print hashtags i.e. # when the package is being unpacked. This will help you to know whether the process is running or stalled.)

Advanced RPM Commands

RPM is a very flexible software management system. It offers a lot of advanced option. Lets have a look at some of them. These will come handy.

Generally each software you install require other software to be installed for it to work. Such other software’s are known as dependencies. When you install any software package, the package manager cleverly probes the package & install its required dependencies. At times, the package manager fails to install the software even if you have the required dependent software already installed on your system. In such rare cases, you can resort to the following command;

# rpm –i foobar-3.4.rpm –nodeps

The above command instructs the package manager to install the software package without taking into account the dependent software i.e. dependencies.

As the number of installed software packages grow on your system, managing them can get quite an arduous task but don’t worry RPM will make this a piece of cake for you.

For e.g. you need to find out about all the software packages installed on your system then you can find so by issuing;

# rpm –qa | less

The above command will output a list of all software packages installed on your system. The pipe is used so that the output can be kept short. If used without the pipe the command will output a huge long list of installed software packages.

In some cases you are left wondering whether you installed a particular software or not. In such cases, you can check the same via issuing;

# rpm –q foobar

In the above command ‘q’ stands for query. The above command will search the RPM database to know whether the software package named foobar is installed or not. If installed, it will return you with the version number of package which is installed. If not, then it will notify you the package is not installed.

Sometimes you need to find out about a software package but fail to recollect its name. Don’t worry, RPM will still come to your rescue in such cases. For e.g. If you need to find out whether Mozilla Firefox is installed but forget Firefox. Then you can use;

# rpm –qa | grep Mozilla

The above command will check through the RPM database & point out each instances where it finds Mozilla in the package name. So you can expect the results to be that of Mozilla Thunderbird or Mozilla Firefox. Once you get that, you can perform any action on that specific software packages as per your wish.

If you want to install an RPM package which is older than the one installed on your system, the following command will come handy.

#rpm –i foobar3.4.rpm –force

You can instruct RPM to ignore the architecture of your system so that you can install package intended for other architecture. This is not recommended. Still it can help at times. Simply enter,

#rpm –i foobar3.4.rpm –ignorearch

Same can be done if you need to install an RPM package intended specifically for a linux distro onto another linux distro. e.g. You need to install package intended for OpenSUSE onto a Fedora system. Again, I recommend getting distro specific packages but if not available you can try installing the application by,

#rpm –i foobar3.4.rpm –ignoreos

Finally, sometimes you can end up with a corrupt RPM database if you interrupt installation process or uninstall any application by deleting its directories instead via RPM command. To correct the RPM database, you can use the following command,