rpmbuild command in Linux is used to build RPM packages. An RPM package is of two types: source RPM and binary RPM. A binary package contains the software to be installed and a source package contains the source code and patch files of the software. Source packages are used to create binary packages.
What is an RPM package?
RPM (Red Hat Package Manager) is an open-source package management utility developed by Red Hat. It is primarily used on Red Hat-based Linux operating systems like Fedora, CentOS, RHEL, etc. An RPM package has .rpm
file extension. An RPM package has the following naming format.
<name>-<version>-<release>.<arch>.rpm
Are you getting rpmbuild - command not found?
You will need to install the following packages to create an RPM package.
# On Red Hat-based distributions (RHEL, CentOS, Fedora)
sudo yum install rpm-build # For RHEL/CentOS
sudo dnf install rpm-build # For Fedora
# On Debian-based distributions (Debian, Ubuntu)
sudo apt-get install rpm
# On SUSE-based distributions (openSUSE, SLES)
sudo zypper install rpm-build
After installing the package, you have to create a proper directory structure to build the RPM package.
$ rpmdev-setuptree
Next, run the tree
command to view the directory structure. The directory should be located in the current user's home folder.
[golinux@localhost ~]$ tree rpmbuild/ rpmbuild/ ├── BUILD ├── RPMS ├── SOURCES ├── SPECS └── SRPMS
We already have written a detailed article to create an RPM package from source code and scratch. In this article, we will explore the different examples of using rpmbuild on RHEL-based Linux distributions.
This tutorial uses the GNU Hello World program package to demonstrate the examples of rpmbuild commands. You can download that package using this link.
Syntax to use rpmbuild command
The general syntax for rpmbuild command is:
rpmbuild [options] <specfile>
rpmbuild requires the name of one or more spec files that represent the package to be built. Additionally, you have to specify the desired stage at which the build should stop. For example, the -bp
option stops after executing the %prep stage and the -bc
option stops after executing the %build stage. It is helpful for monitoring the build's progress, making any necessary changes, and restarting the build.
Here are a list of most used options with rpmbuild command:
-bb <specfile>
: Build binary and source packages.-bs <specfile>
: Build source package only.-bp <specfile>
: Prepare the build (unpack sources and apply patches).-bc <specfile>
: Compile the package.-bi <specfile>
: Install the package after building.-bl <specfile>
: List files in the package.-ba <specfile>
: Build binary and source packages (same as-bb
and-bs
combined).-vv
: Show detailed debugging information.--buildroot <directory>
: Set the build root directory.--define "_topdir <directory>"
: Specify the RPM top directory (default is$HOME/rpmbuild
).--short-circuit
: Skip straight to a specific build stage.--noclean
: Skip the cleaning stage.-h, --help
: Show help message and exit.--version
: Show version information and exit.
1. Execute the %prep stage
The -bp
option tells rpmbuild to execute the %prep stage in the build process. Every command in the %prep section will be executed. Normally, this includes unpacking the sources and applying any patches.
The RPM package is configured by .spec
files. The following is a %prep section from a .spec
file of the GNU Hello program.
%prep %autosetup mv THANKS THANKS.old iconv --from-code=ISO-8859-1 --to-code=UTF-8 --output=THANKS THANKS.old
This command executes the above %prep section.
$ rpmbuild -bp hello.spec
Sample Output:
[golinux@localhost SPECS]$ rpmbuild -bp hello.spec setting SOURCE_DATE_EPOCH=1653091200 Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.K3gTWK + umask 022 + cd /home/golinux/rpmbuild/BUILD + cd /home/golinux/rpmbuild/BUILD + rm -rf hello-2.10 + /usr/bin/tar -xof - + /usr/bin/gzip -dc /home/golinux/rpmbuild/SOURCES/hello-2.10.tar.gz + STATUS=0 + '[' 0 -ne 0 ']' + cd hello-2.10 + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w . + mv THANKS THANKS.old + iconv --from-code=ISO-8859-1 --to-code=UTF-8 --output=THANKS THANKS.old + RPM_EC=0 ++ jobs -p + exit 0
2. Execute the %build stage
The -bc
option execute the %build section from the spec file after doing the %prep section.
$ rpmbuild -bc specfile
Sample Output:
[golinux@localhost SPECS]$ rpmbuild -bc hello.spec setting SOURCE_DATE_EPOCH=1653091200 Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.B10Myf + umask 022 + cd /home/golinux/rpmbuild/BUILD + cd /home/golinux/rpmbuild/BUILD + rm -rf hello-2.10 + /usr/bin/tar -xof - + /usr/bin/gzip -dc /home/golinux/rpmbuild/SOURCES/hello-2.10.tar.gz + STATUS=0 + '[' 0 -ne 0 ']' + cd hello-2.10 + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w . + mv THANKS THANKS.old + iconv --from-code=ISO-8859-1 --to-code=UTF-8 --output=THANKS THANKS.old + RPM_EC=0 ++ jobs -p + exit 0 Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.daPvF5 + umask 022 + cd /home/golinux/rpmbuild/BUILD + cd hello-2.10 + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' + export CFLAGS + CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' + export CXXFLAGS ...
3. Execute the %install stage
When -bi
option is used, the rpmbuild stops once the software is completely built and installed. It means it executes the %install section after the %prep and %build sections.
$ rpmbuild -bi specfile
Sample Output:
[golinux@localhost SOURCES]$ rpmbuild -bi hello.spec ... Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.YiUnxE + umask 022 + cd /home/golinux/rpmbuild/BUILD + '[' /home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 '!=' / ']' + rm -rf /home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 ++ dirname /home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 + mkdir -p /home/golinux/rpmbuild/BUILDROOT + mkdir /home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 + cd hello-2.10 + /usr/bin/make install DESTDIR=/home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 'INSTALL=/usr/bin/install -p' /usr/bin/make install-recursive make[1]: Entering directory '/home/golinux/rpmbuild/BUILD/hello-2.10' Making install in po make[2]: Entering directory '/home/golinux/rpmbuild/BUILD/hello-2.10/po' ... + RPM_EC=0 ++ jobs -p + exit 0 Provides: hello = 2.10-1.el9 hello(x86-64) = 2.10-1.el9 Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 Requires: libc.so.6()(64bit) libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.34)(64bit) libc.so.6(GLIBC_2.4)(64bit) libc.so.6(GLIBC_2.7)(64bit) rtld(GNU_HASH) Processing files: hello-debugsource-2.10-1.el9.x86_64 Provides: hello-debugsource = 2.10-1.el9 hello-debugsource(x86-64) = 2.10-1.el9 Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 Processing files: hello-debuginfo-2.10-1.el9.x86_64 Provides: debuginfo(build-id) = 6c74c9700f99de166fd86f29225d0088f84ee741 hello-debuginfo = 2.10-1.el9 hello-debuginfo(x86-64) = 2.10-1.el9 Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 Recommends: hello-debugsource(x86-64) = 2.10-1.el9 Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64
4. Build a binary package
The -bb
option builds a binary package file after executing the %prep, %build, and %install stages.
$ rpmbuild -bb specfile
Sample Output:
[golinux@localhost SOURCES]$ rpmbuild -bb hello.spec ... Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.YiUnxE + umask 022 + cd /home/golinux/rpmbuild/BUILD + '[' /home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 '!=' / ']' + rm -rf /home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 ++ dirname /home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 + mkdir -p /home/golinux/rpmbuild/BUILDROOT + mkdir /home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 + cd hello-2.10 + /usr/bin/make install DESTDIR=/home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 'INSTALL=/usr/bin/install -p' /usr/bin/make install-recursive make[1]: Entering directory '/home/golinux/rpmbuild/BUILD/hello-2.10' Making install in po make[2]: Entering directory '/home/golinux/rpmbuild/BUILD/hello-2.10/po' ... + RPM_EC=0 ++ jobs -p + exit 0 Provides: debuginfo(build-id) = 6c74c9700f99de166fd86f29225d0088f84ee741 hello-debuginfo = 2.10-1.el9 hello-debuginfo(x86-64) = 2.10-1.el9 Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 Recommends: hello-debugsource(x86-64) = 2.10-1.el9 Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 Wrote: /home/golinux/rpmbuild/RPMS/x86_64/hello-2.10-1.el9.x86_64.rpm Wrote: /home/golinux/rpmbuild/RPMS/x86_64/hello-debugsource-2.10-1.el9.x86_64.rpm Wrote: /home/golinux/rpmbuild/RPMS/x86_64/hello-debuginfo-2.10-1.el9.x86_64.rpm Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.GEBx1R + umask 022 + cd /home/golinux/rpmbuild/BUILD + cd hello-2.10 + /usr/bin/rm -rf /home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 + RPM_EC=0 ++ jobs -p + exit 0
5. Build binary and source packages
The -ba
option directs rpmbuild to perform all the stages in building an RPM package. With this command, rpmbuild:
- Unpacks the original sources and applies patches
- Builds the software
- Installs the software
- Runs the test suite
- Create a binary package file
- Create a source package file
$ rpmbuild -ba specfile
Sample Output:
[golinux@localhost SOURCES]$ rpmbuild -ba hello.spec ... Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.YiUnxE + umask 022 + cd /home/golinux/rpmbuild/BUILD + '[' /home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 '!=' / ']' + rm -rf /home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 ++ dirname /home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 + mkdir -p /home/golinux/rpmbuild/BUILDROOT + mkdir /home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 + cd hello-2.10 + /usr/bin/make install DESTDIR=/home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 'INSTALL=/usr/bin/install -p' /usr/bin/make install-recursive make[1]: Entering directory '/home/golinux/rpmbuild/BUILD/hello-2.10' Making install in po make[2]: Entering directory '/home/golinux/rpmbuild/BUILD/hello-2.10/po' ... + RPM_EC=0 ++ jobs -p + exit 0 Provides: debuginfo(build-id) = 6c74c9700f99de166fd86f29225d0088f84ee741 hello-debuginfo = 2.10-1.el9 hello-debuginfo(x86-64) = 2.10-1.el9 Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 Recommends: hello-debugsource(x86-64) = 2.10-1.el9 Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 Wrote: /home/golinux/rpmbuild/SRPMS/hello-2.10-1.el9.src.rpm Wrote: /home/golinux/rpmbuild/RPMS/x86_64/hello-2.10-1.el9.x86_64.rpm Wrote: /home/golinux/rpmbuild/RPMS/x86_64/hello-debugsource-2.10-1.el9.x86_64.rpm Wrote: /home/golinux/rpmbuild/RPMS/x86_64/hello-debuginfo-2.10-1.el9.x86_64.rpm Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.FCSaID + umask 022 + cd /home/golinux/rpmbuild/BUILD + cd hello-2.10 + /usr/bin/rm -rf /home/golinux/rpmbuild/BUILDROOT/hello-2.10-1.el9.x86_64 + RPM_EC=0 ++ jobs -p + exit 0
6. Install the package
After the RPM package is built, you can install and run it on your system.
Navigate to the RPMS/x86_64
folder in the rpmbuild
directory. Then run the following command to install the Hello World package.
$ sudo dnf install -y hello-2.10-1.el9.x86_64.rpm
Sample Output:
[golinux@localhost rpmbuild]$ cd RPMS [golinux@localhost RPMS]$ ls x86_64 [golinux@localhost RPMS]$ cd x86_64 [golinux@localhost x86_64]$ ls hello-2.10-1.el9.x86_64.rpm hello-debugsource-2.10-1.el9.x86_64.rpm hello-debuginfo-2.10-1.el9.x86_64.rpm [golinux@localhost x86_64]$ sudo dnf install -y hello-2.10-1.el9.x86_64.rpm Last metadata expiration check: 0:56:01 ago on Sat 21 May 2022 10:13:00 PM +0545. Dependencies resolved. =============================================================================== Package Architecture Version Repository Size =============================================================================== Installing: hello x86_64 2.10-1.el9 @commandline 77 k Transaction Summary =============================================================================== Install 1 Package Total size: 77 k Installed size: 201 k Downloading Packages: Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : hello-2.10-1.el9.x86_64 1/1 Running scriptlet: hello-2.10-1.el9.x86_64 1/1 Verifying : hello-2.10-1.el9.x86_64 1/1 Installed: hello-2.10-1.el9.x86_64 Complete!
Run the hello command in the terminal.
[golinux@localhost x86_64]$ hello Hello, world! [golinux@localhost x86_64]$ hello -g "Hello from golinuxcloud!" Hello from golinuxcloud!
7. Override build root
The --buildroot
option instructs RPM to use a directory other than /
as a build root. The build root is not the root directory under which the software is built. It is the root directory for the install phase of the build.
When a build root is not specified, the software being packaged is installed relative to the build system's root directory /
.
Sample Output:
[golinux@localhost SPECS]$ rpmbuild -ba --buildroot /tmp/test hello.spec setting SOURCE_DATE_EPOCH=1653091200 Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.9l1GlE + umask 022 + cd /home/golinux/rpmbuild/BUILD + cd /home/golinux/rpmbuild/BUILD ... Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.Eo3CgV + umask 022 + cd /home/golinux/rpmbuild/BUILD + '[' /tmp/test '!=' / ']' + rm -rf /tmp/test ++ dirname /tmp/test + mkdir -p /tmp + mkdir /tmp/test + cd hello-2.10 + /usr/bin/make install DESTDIR=/tmp/test 'INSTALL=/usr/bin/install -p' /usr/bin/make install-recursive make[1]: Entering directory '/home/golinux/rpmbuild/BUILD/hello-2.10' Making install in po
8. Clean up after build
The --clean
option removes the package's build directory tree at the end of a build.
$ rpmbuild -ba --clean specfile
Sample Output:
[golinux@localhost SPECS]$ rpmbuild -ba --clean hello.spec setting SOURCE_DATE_EPOCH=1653091200 Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.8GMrWT + umask 022 + cd /home/golinux/rpmbuild/BUILD + cd /home/golinux/rpmbuild/BUILD + rm -rf hello-2.10 + /usr/bin/tar -xof - + /usr/bin/gzip -dc /home/golinux/rpmbuild/SOURCES/hello-2.10.tar.gz + STATUS=0 ... Executing(--clean): /bin/sh -e /var/tmp/rpm-tmp.NkAmrb + umask 022 + cd /home/golinux/rpmbuild/BUILD + rm -rf hello-2.10 + RPM_EC=0 ++ jobs -p + exit 0
9. Remove sources after build
The --rmsource
option can be used to remove sources after the RPM package is created.
$ rpmbuild -ba --rmsource specfile
10. Remove spec file after build
If you want to remove the spec file after building the package, you can use the --rmspec
option.
$ rpmbuild -ba --rmspec specfile
11. How to change rpmbuild default directory form /root/rpmbuild directory to other PATH
By default when we create a directory structure using rpmdev-setuptree
then it will create the RPM_BUILD directory structure inside /root
. It is possible that you may have manually created this structure in some other path:
mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
In such case rpmbuild will fail to locate the RPM_BUILD directory so we can provide a custom PATH to rpmbuild in such case:
~]# rpmbuild --define "_topdir /work/workspace/RPM_BUILD" -v -ba /work/workspace/RPM_BUILD/SPECS/hello-world.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.2DzXwc
+ umask 022
+ cd /work/workspace/RPM_BUILD/BUILD
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.SoqLx3
+ umask 022
+ cd /work/workspace/RPM_BUILD/BUILD
+ '[' /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64 '!=' / ']'
+ rm -rf /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64
++ dirname /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64
+ mkdir -p /work/workspace/RPM_BUILD/BUILDROOT
+ mkdir /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64
+ rm -rf /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64
+ mkdir -p /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64/opt/deepak/config/
+ mkdir -p /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64/opt/deepak/common
+ mkdir -p /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64/etc/supervisord.d/
+ mkdir -p /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64/etc/logrotate.d/
+ cd /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64/opt/deepak/zts_ca/bin/
+ cp -a /opt/deepak/hello-world/supervisord.conf /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64/etc/
+ cp -a /opt/deepak/hello-world/caclient.conf /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64/etc/supervisord.d/
+ cp -a /opt/deepak/hello-world/conn_check.conf /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64/etc/supervisord.d/
+ cp -a /opt/deepak/hello-world/grpc_client.conf /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64/etc/supervisord.d/
+ cp -a /opt/deepak/hello-world/logrotate.conf /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64/etc/supervisord.d/
+ cp -a /opt/deepak/hello-world/sdl_security.conf /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64/etc/supervisord.d/
+ cp -a /opt/deepak/hello-world/caclient /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64/etc/logrotate.d/
+ cp -a /opt/deepak/hello-world/ss_watch_client /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64/etc/logrotate.d/
+ cp -a /opt/deepak/hello-world/conn_check /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64/etc/logrotate.d/
+ cp -a /opt/deepak/hello-world/logrotate.conf /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64/opt/deepak/config/
+ cp -a /opt/deepak/hello-world/sec-tools /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64/opt/deepak/common/
+ '[' x86_64 = noarch ']'
+ QA_CHECK_RPATHS=1
+ case "${QA_CHECK_RPATHS:-}" in
+ /usr/lib/rpm/check-rpaths
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: hello-world-test-100-5.x86_64
Provides: hello-world-test = 100-5 hello-world-test(x86-64) = 100-5
Requires(interp): /bin/sh /bin/sh
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires(pre): /bin/sh
Requires(post): /bin/sh
Requires: /bin/bash
Checking for unpackaged file(s): /usr/lib/rpm/check-files /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64
Wrote: /work/workspace/RPM_BUILD/SRPMS/hello-world-test-100-5.src.rpm
Wrote: /work/workspace/RPM_BUILD/RPMS/x86_64/hello-world-test-100-5.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.3htlMR
+ umask 022
+ cd /work/workspace/RPM_BUILD/BUILD
+ rm -rf /work/workspace/RPM_BUILD/BUILDROOT/hello-world-test-100-5.x86_64
+ exit 0
Conclusion
This tutorial teaches you to use different rpmbuild commands on the Red Hat Linux system. We also showed you how to create an RPM package and install it on the system. We hope this article was helpful for you to understand rpmbuild command in Linux. If you have any confusion, let us know in the comment section below.
What's Next
How to download rpm package and all dependencies (RHEL / CentOS 7)
15+ rpm command examples in Linux [Cheat Sheet]
Further Reading
man page for rpmbuild command
rpmbuild Command Reference