What is an RPM? One of the main benefits of open source software is that it lets you access each application’s core. Yet, even with that level of access, there’s…

What is an RPM?

One of the main benefits of open source software is that it lets you access each application’s core. Yet, even with that level of access, there’s a need to run simple tasks (running scripts, starting system services…) in a more simple way. That simplified code is referred to as packages (RPM).

The packages are not universal – they are designed to fit each operating system’s (OS) particular framework. For this to work, each OS comes with its own packet manager. For example, Debian distributions use Advanced Packaging Tool ( APT) while Fedora employs the RPM packet manager.

Fedora, OpenSUSE, Red Hat Entreprise Linux and many others make use of the RPM packet manager. Even the acronym used today – RPM – comes from Red Hat Packaging Manager.

Installing the tools and adding a ‘mock’ user

Before creating your first RPM package, you’ll need to install two tools by running

from your terminal. This installs:

  • fedora-packager – which helps you build packages
  • fedora-review – which reviews the package’s quality

After installing the tools, we’re going to go ahead and add a new user to the ‘mock’ group by running

as under no circumstances should you build and/or test RPMs with the ROOT user.

Building the RPM

For creating the RPM, we’ll need to create a directory to hold the package and .spec file. Spec files contain metadata and information needed to install and compile the software. The file is being named by adding .spec to the package’s name.

Running bash hello should return the desired output – Hello world! Now that we have something worth packaging, we’ll create a file named hello.spec within the directory. Important: Use spaces, not tabs! The indentation is not important with spec files:

You can now run a local build with

This leaves us with a small and not so much functional RPM package that we can use. The next tutorial will explore building RPMs in mock and koji, along with more complex (and useful) RPMs.

Website:
  • Social Links: