RPM completely manages the various software packages on your system. It remembers what it installed and where it installed various files or directories. It cleans up everything efficiently when uninstalling, without leaving unnecessary files or libraries to clutter up your system.
In short, RPM takes most of the brainwork out of maintaining and upgrading the software installed on your Linux system. In this series, we are going to take a look at how to build your own RPM packages. Although many programs are available via RPM, some are not, and you may want to build your own packages to keep a clean system. Or perhaps you want to contribute your favorite non-RPM program to the distribution you use.
Many distributions allow and encourage users to submit source RPM packages. These are then compiled and made available to other users of the distribution. We're going to learn a number of methods of creating clean, efficient RPM packages for whatever distribution you choose. Distributions differ, and so does making RPM packages for various distributions.
File placement, directory placement, available tools, and so on are largely dependent on the distribution you use. Other tools you will want to install, for the Linux Mandrake distribution, are rpmtools , rpmlint , and spec-helper. These tools are new to the forthcoming Linux Mandrake 7. They will work flawlessly under Red Hat, but you might have to rebuild them from source for other distributions.
It will work transparently with RPM when building new packages, so there is nothing for you to learn to make use of it. Although rpmlint is tailored specifically to Linux Mandrake, it can be adapted to work with any other distribution by editing the rpmlint Python script itself. Finally, spec-helper is another set of tools that works transparently with RPM when building packages and will automatically compress man pages and info pages, clean files, strip files, and so forth.
These tools will only work with the RPM version that Linux Mandrake comes with, so if you want to take advantage of these excellent tools, you will need to upgrade the version of RPM on your system to the RPM version that Linux Mandrake provides. Don't worry; it won't break your existing RPM system.
You can download these tools and the Linux Mandrake version of RPM from any of the mirror sites at Linux Mandrake mirror site or from rpmfind. The directories below this root RPM directory all have a specific function. Anything you want to include in your source RPM archives must be placed in this directory. The source RPM package contains the source files and.
Defining the RPM header As you now know, the. With a single. For example, you can create a program RPM and a program-devel RPM, where the first package contains the actual program, and the second package contains any programming-related files that might be required by other programs needing those libraries or header files.
It handles patching source code, building source code, installing binaries and libraries, packaging and compressing files, and so forth. Without the. This is where we are going to create the. For this tutorial, we are going to build a simple RPM for a Perl script called rpmproc which, incidentally, is an RPM management script that works very nicely and takes a lot of the brainwork out of the actual building of RPMs. Download the source code for rpmproc from Freezer Burn and save the rpmproc Now, create a new file called rpmproc.
The first thing we will do is make a few define statements. These define statements create variables that can be used throughout the. The second define statement creates the version variable with a value of 1. The final define statement creates the release variable, which we define as 1mdk. All other distributions simply use the release number without any appended characters. With these three pieces of information we have created the file name of our RPM. The resulting file name will be rpmproc The next section deals with the informational part of the.
This is by no means an exhaustive document. It only tries to explain how things work under the hood. While this is the basic process, the RPMs we get from repositories are built on dedicated servers with strict configurations and methods to ensure correctness and security. This Fedora packaging pipeline will be discussed in a future post. Would you like to get started with building packages, and help the Fedora community maintain the massive amount of software we provide?
You can start here by joining the package collection maintainers. I'm just another Fedora contributor. Fedora Linux 35 is available now. Read the release announcement for all the details. Email Address. The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases.
You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions. This can hopefully help folks who are for some reason stuck without X, working remotely, or any other reason they may be unable to paste something into the pastebin Name , Version , and so on are called tags , and are defined in RPM.
The tags to keep an eye out for are: Source0 : tells RPM where the source archive for this software is located. Requires : lists run-time dependencies for the software. RPM can automatically detect quite a few of these, but in some cases they must be mentioned manually.
A run-time dependency is a capability often a package that must be on the system for this package to function. This is how dnf detects whether it needs to pull in other packages when you install this package.
BuildRequires : lists the build-time dependencies for this software. These must generally be determined manually and added to the spec file. BuildArch : the computer architectures that this software is being built for.
You can use the yumdownloader and rpm commands to download and install the source code for most packages which can be yum installed. For example, the following demonstrates how to get the source code for the vnc-server package:. First use the " yumdownloader " command to get the RPM package of interest. Then use the " rpm2cpio " and " cpio " utilities for conversion to " cpio " format and extraction.
The rpmrebuild utility is a tool to build an RPM file from a package that has already been installed. This tool does not require any RPM building knowledge.
0コメント