![](https://csdnimg.cn/release/download_crawler_static/89327575/bg1.jpg)
Maxim Svistunov Red Hat Marie Doleželová
Red Hat Adam Miller Red Hat
Red Hat Enterprise Linux
7
RPM Packaging Guide
Basic and Advanced RPM Packaging
![](https://csdnimg.cn/release/download_crawler_static/89327575/bg2.jpg)
![](https://csdnimg.cn/release/download_crawler_static/89327575/bg3.jpg)
Red Hat Enterprise Linux 7 RPM Packaging Guide
Basic and Advanced RPM Packaging
Maxim Svistunov
Red Hat Customer Content Services
msvistun@redhat.com
Marie Doleželová
Red Hat Customer Content Services
mdolezel@redhat.com
Adam Miller
Red Hat
![](https://csdnimg.cn/release/download_crawler_static/89327575/bg4.jpg)
Legal Notice
Copyright © 2017 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons
Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is
available at
http://creativecommons.org/licenses/by-sa/3.0/
. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must
provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert,
Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, OpenShift, Fedora, the Infinity
logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other
countries.
Linux ® is the registered trademark of Linus Torvalds in the United States and other countries.
Java ® is a registered trademark of Oracle and/or its affiliates.
XFS ® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States
and/or other countries.
MySQL ® is a registered trademark of MySQL AB in the United States, the European Union and
other countries.
Node.js ® is an official trademark of Joyent. Red Hat Software Collections is not formally related to
or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack ® Word Mark and OpenStack logo are either registered trademarks/service marks
or trademarks/service marks of the OpenStack Foundation, in the United States and other countries
and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or
sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
Abstract
The RPM Packaging Guide documents packaging software into an RPM. It also shows how to
prepare source code for packaging. Lastly, the guide explains selected advanced packaging
scenarios.
![](https://csdnimg.cn/release/download_crawler_static/89327575/bg5.jpg)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents
CHAPTER 1. INTRODUCTION
1.1. DOCUMENT CONVENTIONS
1.2. PREREQUISITES
CHAPTER 2. PREPARING SOFTWARE FOR PACKAGING
2.1. WHAT IS SOURCE CODE?
2.2. HOW PROGRAMS ARE MADE
2.2.1. Natively Compiled Code
2.2.2. Interpreted Code
2.2.2.1. Raw-interpreted programs
2.2.2.2. Byte-compiled programs
2.3. BUILDING SOFTWARE FROM SOURCE
2.3.1. Natively Compiled Code
2.3.1.1. Manual Building
2.3.1.2. Automated Building
2.3.2. Interpreted Code
2.3.2.1. Byte-Compiled Code
2.3.2.2. Raw Interpreted Code
2.4. PATCHING SOFTWARE
2.5. INSTALLING ARBITRARY ARTIFACTS
2.5.1. Using the install command
2.5.2. Using the make install command
2.6. PREPARING SOURCE CODE FOR PACKAGING
2.7. PUTTING SOURCE CODE INTO TARBALL
2.7.1. bello
2.7.2. pello
2.7.3. cello
CHAPTER 3. PACKAGING SOFTWARE
3.1. RPM PACKAGES
3.1.1. What is an RPM?
3.1.2. RPM Packaging Tools
3.1.3. RPM Packaging Workspace
3.1.4. What is a SPEC File?
3.1.4.1. Preamble Items
3.1.4.2. Body Items
3.1.4.3. Advanced items
3.1.5. BuildRoots
3.1.6. RPM Macros
3.1.7. Working with SPEC files
3.1.7.1. bello
3.1.7.2. pello
3.1.7.3. cello
3.2. BUILDING RPMS
3.2.1. Source RPMs
3.2.1.1. To create a SRPM:
3.2.2. Binary RPMS
3.2.2.1. Rebuilding from a Source RPM
3.2.2.2. Building Binary from the SPEC file
3.3. CHECKING RPMS FOR SANITY
3.3.1. Checking the bello SPEC File
3.3.2. Checking the bello Binary RPM
4
4
4
6
6
7
7
7
7
7
7
8
8
8
9
9
10
10
12
12
13
14
14
15
15
16
17
17
17
17
17
18
18
20
21
21
21
22
24
28
34
38
38
39
39
39
40
40
41
41
Table of Contents
1