05. RPM Package Manager

The one other major package manager we will discuss is RPM (RPM Package Manager), which was developed by Red Hat under the General Public License. RPM is used in several distros - RedHat, Fedora, SUSE/openSUSE, and Mandriva.

Package Naming Convention

RPM files have a more stringent convention than the packages found for Debian. You may find these packages at the RPM repository or simply through the yumdownloader command. In this lesson, we'll look at installing Ninvaders, space invaders for the command line!

Firstly, we want to install the package with the following command:

# yumdownloader ninvaders      


Package Name
The name of the package.
Version Number
The version number.
Build Number
Minor changes made not by the package author but the package maintainer. These include small tweaks in configuration files or added documentations. Here, we can also see that this was the 12th build version, made for Fedora 23.
The package architecture. For example, i386 would signify the CPU's from 80386 onward. Here, we have the a x86_64 architecture.

The rpm command

rpm installs, verifies and queries RPM packages. Included are actions, along with options for fine-tuning. We'll look at the most well-used options, but for a more comprehensive list, check the man page.

# rpm [action][options] [package]

Below are some general options you can use with the rpm command.

General Options

Print a longer usage than normal.
Print out the version number of rpm.
Print as little as possible.

Now here are five of the most commonly used actions with rpm.

1) Querying

You can verify if a package is installed with the -q option. This will print out its name, version and release name.

# rpm -q ninvaders
package ninvaders is not installed# rpm -q openssh

Here, we can see that openssh is already installed, while ninvaders is not.

If you already know that a program is installed, tack on the -i option to check its information.

# rpm -qi openssh
Name : openssh Version : 7.1p1 Release : 3.fc23 Architecture: x86_64 Install Date: Thu 29 Oct 2015 02:23:32 PM PDT Group : Applications/Internet Size : 1586400 License : BSD Signature : RSA/SHA256, Fri 25 Sep 2015 06:44:55 PM PDT, Key ID 32474cf834ec9cba Source RPM : openssh-7.1p1-3.fc23.src.rpm Build Date : Fri 25 Sep 2015 05:31:51 AM PDT Build Host : buildvm-14.phx2.fedoraproject.org Relocations : (not relocatable) Packager : Fedora Project Vendor : Fedora Project URL : http://www.openssh.com/portable.html Summary : An open source implementation of SSH protocol versions 1 and 2 Description : SSH (Secure SHell) is a program for logging into and executing commands on a remote machine. SSH is intended to replace rlogin and rsh, and to provide secure encrypted communications between two untrusted hosts over an insecure network. X11 connections and arbitrary TCP/IP ports can also be forwarded over the secure channel. OpenSSH is OpenBSD's version of the last free version of SSH, bringing it up to date in terms of security and features. This package includes the core files necessary for both the OpenSSH client and server. To make this package useful, you should also install openssh-clients, openssh-server, or both.

To list all packages listed in your system, use:

# rpm -qa
... libvisio-0.1.3-2.fc23.x86_64 libsysfs-2.1.0-18.fc23.x86_64 librdmacm- spice-glib-0.30-1.fc23.x86_64 sssd-client-1.13.1-2.fc23.x86_64 ...

We can also query as to what dependencies a package fulfills.

# rpm -q --whatrequires openssh
openssh-clients-7.1p1-3.fc23.x86_64 openssh-askpass-7.1p1-3.fc23.x86_64 openssh-server-7.1p1-3.fc23.x86_64

2) Installing

To install a package, change into the directory that holds the .rpm file, then run with the -i option. With this, rpm will check for dependencies, conflicts, set config files, and unpack the files to place them in the right folders.

# rpm -ivh ninvaders-0.1.1-12.fc23.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
1:ninvaders-0.1.1-12.fc23          ################################# [100%]

The -i option does the actual installing, while the -v option is for verbosity, and -h is to display hash marks for progression.

To specify a root folder, you may add the --root dir option. This will specify where the root directory, which is helpful if you have more than one Linux installation.

When installing, you may run into dependency issues. To force the installation, use the --force option. To not check for dependencies, use --nodeps.

Now that we've installed ninvaders, we can play it by typing nInvaders!

3) Upgrading

To upgrade a package to its most recent version, use the -U option for upgrade (or install if unavailable) or -F for freshen.

# rpm -Uvh ninvaders-0.1.1-12.fc23.x86_64.rpm     

4) Uninstalling

To uninstall a package, specify the package name (not the .rpm) file.

# rpm -e ninvaders    

Configuration files

The RPM configuration file is located in /usr/lib/rpm/rpmrc. If you want to create your own settings, edit /etc/rpmrc or set a ~/.rpmrc file within your home folder.

Notably, this file allow you to fine-tune the compilation process, according to the CPU being used.

Just like how dpkg doesn't provide you with the ability to install and manage package dependencies, rpm does not either. Instead, we can use yum, which we will discuss next.

Take your Linux skills to the next level!

Linux for Beginners

Take your Linux skills to the next level! Try Linux & UNIX

Linux for Beginners doesn't make any assumptions about your background or knowledge of Linux. You need no prior knowledge to benefit from this book. You will be guided step by step using a logical and systematic approach. As new concepts, commands, or jargon are encountered they are explained in plain language, making it easy for anyone to understand.

$ Check price
24.9924.99Amazon 4.5 logo(101+ reviews)

More Linux & UNIX resources

Want to avoid becoming a code monkey?

The Pragramatic Programmer

Want to avoid becoming a code monkey? Try Good Practice

The Pragmatic Programmer illustrates the best practices and major pitfalls of many different aspects of software development.Whether you're a new coder, an experienced programmer, or a manager responsible for software projects, use these lessons daily, and you'll quickly see improvements in personal productivity, accuracy, and job satisfaction.

$ Check price
49.9949.99Amazon 4.5 logo(338+ reviews)

More Good Practice resources