Product SiteDocumentation Site

Chapter 2. Creating and Building Packages

2.1. Preparing a Build Environment
2.1.1. Creating a Non-Root Buildroot
2.2. Creating a Basic Spec File
2.2.1. Creating an Example Spec File for eject
2.3. Building a Package
2.3.1. Building an Example Package: eject
2.4. Testing a Package
2.4.1. Testing a Spec File
2.4.2. Testing a Spec File, Binary, and Source Package
2.4.3. Testing a Package with Mock
This chapter shows you how to convert a source archive into an RPM package.

2.1. Preparing a Build Environment

This section shows how to prepare an environment for building RPM packages on your system.

2.1.1. Creating a Non-Root Buildroot

These steps show how to create a non-root buildroot environment. This non-root environment is used to build packages as a normal user, without the need of becoming the root user. Because some of the software source archives can contain code in a makefile or script that can possibly damage your system, it is highly recommended to build packages as a user that does not have full access to the system.
Procedure 2.1. Creating a non-root buildroot
  1. As root, install the rpmdevtools package with the following command:
     yum install -y rpmdevtools 
  2. As a normal user, run the following command to create the ~/rpmbuild/ directory where packages are built:
     rpmdev-setuptree