System administrations

In this article from our series of RHCE exam guide we will learn how we can install or remove package in linux.

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. In this article we will by no means provide comprehensive coverage of rpm. Instead, we will highlight the subset of options we have found useful in the real RHCE Exam.

Querying Your System

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

#rpm -qa | more

rpm

In case you are unfamiliar with the command line, let me break this command down.

rpm
is the command name.It tells the computer you want to run the rpm program.

(-)
In linux, the set of letters following a dash (-) is called an option or switch.

-q
tells rpm you want the query operation.

a following a in the -qa is a modifier for the query option which tells rpm you want to list all the packages.

| more
The | more part of the above command is not a feature of rpm at all. It is a standard linux way to show output one page at a time.

package info

Rpm is smart enough to use the package name without the version info.For example see in image

rpm

The package info is split into three pieces.

  • The first piece is the package name.
  • The second is the software version number.
  • The third is the package build number.

All three are separated by dashes. The package build number is important incase if there is a more recent rpm build of a program with the same version

Installing New Software

You can install rpm from any location where you have it. In our example we will install it from RHEL dvd.

Command to install package is

#rpm -ivh <package name>

rpm

-i is the install switch.
v for verbose messages in case if the installation fails.
h option shows our progress with hash marks.

A variation on an install is an upgrade. An upgrade is used when you want to put a more recent package in place of something that is currently installed . The upgrade syntax is exactly the same as an install, but you replace the -i with a -U. (Notice it is a capital U) If a new version of telnet-server comes out, rpm will take care of removing all the old pieces when you upgrade.

rpm -Uvh

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.It will install rpm in any conditions.

Dependencies are generally regarded as a good thing. Rpm has the capability to know if software has such prerequisites. In the real world, not everything on your system can always be from an rpm. So if you want to install rpm without checking dependencies you can use --nodeps options

#rpm -ivh --nodeps package-1.0-5.i386.rpm

rpm -Uvh --nodeps --force

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 telnet-server

rpm -e