Creating a new RPM package 2 – Software Management with DNF

Share this post on:

The skeleton is very sparse and will need information added.

The sample skeleton is seen as follows:

Figure 5.28 – Basic .spec file

Much has to be done to make this functional.

The Version and Summary sections need to be filled in, as well as the License details and a URL for the project. Additionally, set the build architecture to noarch, as this will install on both ARM and X64 systems. It is important to make sure that you include the Name, Epoch, Version, Release, and Architecture (NEVRA) information. This is used to help make sure the correct RPMs are installed on the system.

A description is set, and the %install section is updated to reflect the script being installed in the normal binary directory.

The %files section shows that /usr/bin/xyzzy.sh because all .sh files are added to the installer. Unused sections are also removed.

The final result is as follows:

Figure 5.29 – Finished .spec file

6. The rpm file will be built using the rpmbuild command, passing it the location of the .spec file. The rpmbuild -bb -v SPECS/xyzzy.spec command is used, with the following output:

Figure 5.30 – The output of rpmbuild

7. The RPM file is now in the RPMS directory, under the noarch directory:

Figure 5.31 – The RPM file

This RPM file can now be copied over to systems to be manually installed, or it can be added to a YUM repo.

8. Once installed, you can use the rpm -qi xyzzy-1.0 command to see the details from the .spec file for license, description, and so on:

Figure 5.32 – RPM file details

The RPM tool allows you to easily build custom RPM files for distribution. This is driven by the .spec file, which contains all the dependencies, descriptions, file locations, and even build info to create the RPM file.

Share this post on:

Leave a Reply

Your email address will not be published. Required fields are marked *