Build RPMs
Build RPM packages for sample bello, pello, and cello programs by using the rpmbuild utility.
Different use cases require different combinations of arguments to the rpmbuild command. The following are the main use cases:
- Building source RPMs.
- Building binary RPMs:
- Rebuilding a binary RPM from a source RPM.
- Building a binary RPM from the
specfile.
rpmbuild command, a certain directory and file structure is expected, which is the same as the structure that was configured by the rpmdev-setuptree utility.Build a source RPM Copy linkLink copied!
Put a source code of the bello, pello, and cello sample programs into Source RPM (SRPM) packages by using the rpmbuild utility.
Before you begin Copy linkLink copied!
- You installed the
rpmbuildutility on your system:# dnf install rpm-build - You placed the following
Hello World!implementations into the~/rpmbuild/SOURCES/directory: - A
specfile for the program that you want to package exists.
About this task Copy linkLink copied!
Building Source RPMs (SRPMs) has the following advantages:
- You can preserve the exact source of a certain
Name-Version-Release(NVR) of an RPM file that was deployed to an environment. This includes the exactspecfile, the source code, and all relevant patches. This is useful for tracking and debugging purposes. - You can build a binary RPM on a different hardware platform or architecture.
Procedure Copy linkLink copied!
Results Copy linkLink copied!
- Verify that the
rpmbuild/SRPMSdirectory includes the resulting source RPMs. The directory is a part of the structure expected byrpmbuild.
Rebuild a binary RPM from a source RPM Copy linkLink copied!
Rebuild binary RPM packages for sample bello, pello, and cello programs from their source RPM (SRPM) packages by using the rpmbuild utility. You can then install and run the binary packages on multiple systems.
Before you begin Copy linkLink copied!
- You installed the
rpmbuildutility on your system:# dnf install rpm-build
About this task Copy linkLink copied!
The output generated when creating the binary RPM is verbose, which is helpful for debugging. The output varies for different examples and corresponds to their spec files.
The resulting binary RPMs are located in either of the following directories:
~/rpmbuild/RPMS/YOURARCH, whereYOURARCHis your architecture~/rpmbuild/RPMS/noarch/, if the package is not architecture-specific
Procedure Copy linkLink copied!
Build a binary RPM from a spec file Copy linkLink copied!
Build binary RPMs for sample bello, pello, and cello programs from their spec files by using the rpmbuild command.
Before you begin Copy linkLink copied!
- You have installed the
rpmbuildutility on your system:# dnf install rpm-build