RPM Packaging tutorial for Fedora

Hi again! You might be surprised for I post this in less than 24 hours after the previous one, so did I.ย ๐Ÿ˜

Here will I share my first ever experience on packaging an RPM package in Fedora Linux. Umm, actually not the first time though, as I have been trying this before, but I didn’t record it in my mind. I mean I forget when or how it was going.ย ๐Ÿ˜

So, now I redid it from scratch, assuming that I have never done this before. I have asked a pal via Fedora Indonesia channel on Telegram, @alunux and he gave me some references, some kind of advanced topics on how to packaging RPM. I just recalled a sample ofย SPEC file for creating an RPM package, picked from Steam client for Linux. It’s so advanced for me, that I found a more basic tutorial instead.


I just googled “simplest tutorial fedora make rpm” and the first search result was this: How to create a GNU Hello RPM package. That article gives a clear step by step guide to create an RPM from the simple “Hello World” application by GNU project. Just the same as the first time I tried creating DEB package in Ubuntu. Such a regained excitement.ย ๐Ÿ˜

So, according to the tutorial, the steps for creating RPM package in brief is as follows:

1. Installing development tools for packaging
`# dnf install fedora-packager @development-tools`
2. Add me as `mock` user
`# usermod -a -G mock `
3. Setting up directory environment (in home)
4. Change dir to ~/rpmbuild/SOURCES and download `hello` source code
`wget http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz` (I used `curl` instead, as my Fedora didn’t have `wget`
5. Change dir to ~/rpmbuild/SPECS and make a SPEC file
`rpmdev-newspec hello`
6. Edit the SPEC file to match our need
In this case for Hello World app
7. Make the RPM
`rpmbuild -ba hello.spec`
8. Lint the SPEC and RPMs and fix some errors if any
`rpmlint hello.spec ../SRPMS/hello* ../RPMS/*/hello*`
9. Check if the src.rpm could be built in a restricted build environment
`mock –verbose ../SRPMS/hello-2.10-1.fc26.src.rpm` (I have Fedora 26, while in the tutorial 25). This step was actually doing the same steps above in a kind of sandboxed environment inside our Fedora, including the installation of the dev tools.

And voila! I had Hello World RPM ready to be installed with DNF. I actually need to make the RPM package for my app which has been packaged in a DEB by Launchpad, long ago. And next, I will learn more the RPM packaging and use COPR build server provided by Fedora. Wish me luck. ๐Ÿ˜


Published by


A Muslim, sober, a Javanese

Share your idea here (markdown enabled)

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s