Linux+: Applications 01 – RPM Package Install, Upgrade and Remove

J

Jarret W. Buse

Guest
Linux+: Applications 01 – RPM Package Install, Upgrade and Remove

All Linux systems have some type of package manager. The package managers are used to build, install, update, verify, search and remove applications. The package managers that most people are familiar with are either rpm or dpkg. RPM is for Red Hat systems and dpkg is for Debian based systems.

NOTE: Do not confuse RPM with Yum. Yum is a command-line front-end for RPM. Apper and other such programs are a GUI front-end for both.

This article covers the use of RPM from a command-line. It is assumed that any packages (files with an extension of RPM) are located locally on the system. The Yum utility and Apper GUI is used to actually perform downloading of the package to the local system. Once the package is downloaded locally, Yum or Apper calls RPM in the background to perform the actual desired command on the package.

There are five basic modes for RPM:

1. Install : It is used to install any RPM package.
2. Remove : It is used to erase, remove or un-install any RPM package.
3. Upgrade : It is used to update the existing RPM package.
4. Verify : It is used for the verification of any RPM package.
5. Query : It is used to query about different RPM packages.

This article will cover the Install, Remove and Upgrade modes for RPM. The syntax is:

RPM action options package_name

The actions are as follows:

-i (--install) – used to install the specified package by package_name
-U (--upgrade) – used to upgrade the specified package by package_name. The original application will be uninstalled before the new package is installed
-F (--freshen) – used to update an existing installation without removing the old one, package is listed as package_name
-e (--erase) – removes existing installation of the specified package by package_name

The installation options are as follows:

--aid – adds any suggested packages
--allfiles – installs all missing files in the package
--badreloc – allow relocation on file paths
--excludepath STRING – skip files where filename begins with STRING
--excludedocs – skips documentation files during install
--force – same as using the options --replacepkgs, --replacefiles, and --oldpackage
-h,--hash – displays fifty hash marks during package unpacking
--ignoresize – skip free space check
--ignorearch – perform installation even if architecture is incorrect
--ignoreos – install package even if OS is not compatible
--includedocs – document files are installed (default)
--justdb – update database only and not file system
--nodeps – skip dependency checks
--nodigest – skip package and header digest verification
--nosignature – skip header and file signature verification
--nosuggest – dependency packages are not suggested
--noorder – package order is not changed to help satisfy dependencies
--noscripts – skip running scriplet
--notriggers – do not run trigger scriptlet
--oldpackage – allows a newer package to be overwritten with an older version
--percent – display unpacking percentages of package files
--prefix NEWPATH - relocate binaries to specified new path
--relocate OLDPATH=NEWPATH – transfers all binaries starting with OLDPATH to the new path specified
--repackage – repackage all files before they are removed
--replacefiles – install all files from package even if other files are overwritten
--replacepkgs – install packages even if some exist
--test – package is not installed, but checked for possible problems if it were installed
-v – detailed output during install


Now that the basics are out of the way, let's look at some practical examples.

Let's assume you have downloaded a package called Application.rpm which you want to install. The simplest command would be: “rpm -i Application.rpm”. The “-i” parameter is for “install”. If you want more details during the install, the command would then be “rpm -iv Application.rpm” where the “v” parameter is for verbose output. Other options can be added as needed.

To remove the package after it is not needed, the command would then be: “rpm -e Application.rpm”. Again, other parameters can be added as required such as the “v” parameter if more details are needed.

To upgrade, or freshen a package, you need to understand the difference. To upgrade a package, the old package is removed first and the package is reinstalled. If an upgrade is performed and the package is not installed, it will then be installed. When a package is freshened, the package is installed over the top of the existing package. The package must exist for the freshen parameter to work. If the package does not exist, the freshen command will abort. To freshen a package is to place the original package files over the top of the existing one. Any configuration information should not be overwritten.

To upgrade a package, the following command is used: “rpm -U Application.rpm”. If you should want more details as well as hash marks to show the progress of the command, use the following: “rpm -Uvh Application.rpm”

To freshen a package, use the command: “rpm -F Application.rpm”.

Be aware of these commands and the parameters for the certification exam. Following articles will cover the other RPM Modes as listed at the beginning of the article.
 

Attachments

  • slide.jpg
    slide.jpg
    32.9 KB · Views: 30,479

Members online


Top