RPM was the most famous way of installing packages on a Red Hat based linux box, nowadays other distros are also using RPM to support their software, Suse and Mandriva fall in the zone. RPM stands for Red Hat Package Manager. RPM lets you install a package, upgrade and uninstall the same. It also allows a querying functionality which lets one know about already packages installed on the system.
RPM packages are those with a .rpm extension. RPM packages contains the actual software to be installed and other files that are needed to carry out its installation. RPM packages are distributed distro specifically. Any attempt to install one distro-specific package on another distro might result in undesired consequences. You have been warned !
Graphical installation tools install a package in few clicks but here discussed is old school command line method which has its own legacy.
From here on, you need to have root’s privileges.
To install rpm package, rpm command is used along with -i option which clearly stands for “install”:
rpm -i package.rpm
Packages are subjected to regular upgradations, to update an installed rpm package, engage following code.
rpm -U package.rpm
On a fine day, everything will go well and the rpm package will be installed on your system ready to be launched from command line. Installed software, rather than creating its own directory, goes into pre-created linux directories. Executable files find their path to specific bin directories. To shoot the program from command line, the whole path is not needed just the program name is sufficient.
If things go south during installation, it can be very irritating. Most famous error that comes up is due to failed dependency. Dependencies are the packages that are needed for installing package to mover further in installation process. They are just software that are needed for proper functioning of the package being installed. While installing, the database is checked for needed packages, if not present, it stops the installation process due to failed dependency.
To rectify, one way is to install/upgrade those missing packages (don’t worry it will tell you which packages are not present ) then continue with the current installation. Some times, this error is as meaningless as ‘ay’ in ‘okay’. An entry is made in database only when the package is installed via rpm. If any other method is used, the entry is not made and despite presence of files, “failed dependency” error shows up.
When you are sure that the needed files are already on your system, you can skip the dependency check and install rpm package anyway.
rpm -i package.rpm --nodeps –nodeps option installs it without checking for dependency.
If you try to fool your system by going with –nodeps right away, the program won’t work at all.
rpm command along with -e option is used to remove a package installed with rpm.
rpm -e package.rpm -e is for “erase”
Note: While installing rpm package we included the whole package name but at the time of removing- only the program name can be used ignoring the extension.
rpm -e package This code works the same as above.
It removes all the files related to that package and also deletes the entry from database. Manually removing individual files will not affect database which can lead to dependency errors in future.
As mentioned earlier in the very article, the database knows what packages are installed on the system. The database can be queried to check if certain package exists on the database. For a single package query, command goes like:
rpm -q package
If the package is present, it returns the version of package installed, else, it says the package is not installed.
To list all the rpm packages installed on the system, run :
To check for certain package in the list, “grep” can be used. We will cover that later, stay tuned.