Skip to main content
LPIC-1 Exam 101

102.5 Use RPM and YUM package management

Weight 3
Description Candidates should be able to perform package management using RPM and YUM tools.

Key Knowledge Areas:

  • Install, re-install, upgrade and remove packages using RPM and YUM.
  • Obtain information on RPM packages such as version, status, dependencies, integrity and signatures.
  • Determine what files a package provides, as well as find which package a specific file comes from.

The following is a partial list of the used files, terms and utilities:

  • rpm
  • rpm2cpio
  • /etc/yum.conf
  • /etc/yum.repos.d/
  • yum
  • yumdownloader

Software management in Linux will differ depending to the type of distribution you are using. Debian based systems like Debian, Ubuntu and Mint use .deb files and the Debian package management tools; where as distributions based around the red Hat Package Management system will use RPM files. In this module we will look at at the RPM tools and YUM software repositories.


The Red Hat Package Management tool are not only available on Red Hat but also Fedora , CentOS and SUSE based system as well as many other Linux distributions that choose to use this form of software management. Using the raw RPM commands over those of the software repository system YUM, does have it advantages. We can download the latest version of software direct from vendor websites without waiting for them to appear in an online repository. Also, working with the RAW tools we get a better insight into the the software dependencies and what is installed on our systems. Of course the disadvantages move in the same vein in that, as we have to manage the dependencies we have to make sure we locate and install all the required software too. I think you will understand why it is required to know both the YUM and RPM mechanisms for the exam.

Once we have downloaded or otherwise located our .rpm file we can install it on our system with root privileges. We can also query the package before hand to make sure it is what we want to install.

rpm -qpi <nameoffile>.rpm
rpm -qpl  <nameoffile>.rpm

Both these commands are run against the rpm before it is installed onto the system the first will list the information contained in the package about the rpm and the second will list all the files

rpm -ih<nameoffile>.rpm

This command will install the rpm file and supply progress in the form of HASH marks (-h). Once installed we can query all the installed packages with:

rpm -qa

This can list the actual names of the packages and then we can again query the installed packages using the package name rather than the file name and omitting the -p option.

rpm -qi <nameofinstalledpackage>
rpm -ql <nameofinstalledpackage>

Should we want to remove the installed package we can remove it with:

rpm -e <nameofinstalledpackage>
rpm -qa (will list all package names installed on the system)

Additionally we can query files withinn the file-system to see which package they belong to

rpm -qf <filename>

Access files within the RPM

It is possible to extract files if required from your RPM files. This is done though the tool rpm2cpio

rpm2cpio <nameofrpm>.rpm > output.cpio
cpio -i --make-directories < output.cpio

In the first line we convert the rpm file to a cpio archive and in the second we extract the archive. The RPM will be extracted to the current directory. In the video we open the Adobe Reader rpm and an opt directory is created with directories below containing all the files of the rpm.

Using YUM

If we choose to use the YUM tools, Yellowdog Update Modified, then we can make life just a little more easy for ourselves. Yum will look in online repositories for the software and we can search their names and descriptions, making it much easier to locate and install software. Along with this YUM will manage the depancancies as long as they too are located with a software reposiories. Many systems including CentOS that we use in the video will install software from the online repositories automatically once the system is up and running.

  • yum –help to list options
  • yum search nmap to search for the nmap package
  • yum provides namp to search for packages that contan the file nmap
  • yum info nmap to show information on the nmap package weather installed or not
  • yum list to list the state of all packages
  • yum list nmap to list just the state of nmap
  • yum install nmap installs nmap
  • yum provides /usr/bin/nmap which package does the nmap file come from
  • yum provides /etc/yum.conf which package does the yum configuration file belong to
  • yum remove nmap uninstalls nmap
  • yum grouplist list package groups
  • yum groupinstall “MySQL Database” Install all packages to support MySQL