From the course: Building, Maintaining, and Distributing RPM Packages

Tools and the build process

- [Instructor] Building RPM packages requires a set of programs and scripts that take care of various steps of the process. These tools handle setting up the environment we'll use to develop a package, checking the packages to ensure they conform to standards, signing packages, and more. In order to install these tools, I'll run DNF install rpmdevtools. I'm going to install tree here as well to help visualize the contents of directories. Once that's installed, we can take a look for the tools provided by the RPM development packages by typing RPM and pressing tab. Of these, the ones we'll use the most are rpmdev-setuptree, rpmdev-newspec, and rpmbuild. There's a handful of other tools that will be useful too. When we go about creating a package, we'll take a few steps. In this course we'll assume that anything we want to package up has already been collected together or the code for it has been written and tested and delivered to us as source files. Again, this course is focusing on the perspective of a system administrator rather than a software developer. With our files available, the process will follow to make a package looks like this. First we'll use rpmdev-setuptree to set up a directory structure for the package creation software to use and for us to use in order to organize our files. This creates a directory called rpmbuild in your user home directory and it'll be the home for all the packages you create. The RPM build software will look for files there and as long as they represent packages with different names or versions, which they should anyway, there won't be any problems. Then we'll create a spec file with rpmdev-newspec and populate it to define the parameters of the package, including instructions for building the software if necessary. That will go into the specs directory. Then we'll package up the files that we want to use in our package as a compressed tar file and put that into sources. Then we'll use rpmbuild to build the RPM. Rpmbuild will read the spec file and follow the directions to prep the environment and build the software. We'll use the build directory as the builder route, a true like environment where files will be staged in directories relative to the route, mimicking the locations where the files will end up on target computers before they're put into the package. If you're building a binary package, the package file will end up in the RPMS directory within rpmbuild. If you're building a source RPM, it'll end up in the SRPMS directory. Once we're done building a package, we'll have files ready to distribute.

Contents