Web Projects Outsourcing

Creating self-signed RPM packages in Fedora

Creating your own self-signed rpms is a pain in the neck for newbies, especially when you start reading online docs form fedora docs site. You have an impression that people writing that stuff were specially trained to use understandable language so that all laymen should keep away.

However, everything is quite fast and beautiful.

rpm, package, Fedora, self-signed

Install needed stuff.

sudo yum -y groupinstall "Development Tools"
sudo yum -y install rpmdevtools
sudo /usr/sbin/useradd makerpm
sudo yum -y install gnupg

Setup development tree.


Generate a key, answer a couple of very simple to most people questions, remember resulting ID.

gpg --gen-key

Save and import the key

mkdir -p ~/Documents/keys/
gpg -a --export "Generated Key Id here" > ~/Documents/keys/RPM-GPG-KEY-local
sudo rpm --import ~/Documents/keys/RPM-GPG-KEY-local

Check ~/.rpmmacros file:

%_topdir %(echo "$HOME")/rpmbuild
%_builddir          %_topdir/BUILD
%_rpmdir            %_topdir/RPMS
%_sourcedir         %_topdir/SOURCES
%_specdir           %_topdir/SPECS
%_srcrpmdir         %_topdir/SRPMS
%_buildrootdir      %_topdir/BUILDROOT
%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}
%_signature gpg
%_gpg_name Generated Key Id here

Sign previously built packages.

rpm --addsign ~/rpmbuild/RPMS/x86_64/some.package.rpm

Check previously built packages.

rpm -K ~/rpmbuild/RPMS/x86_64/some.package.rpm

You now should be able to install self-signed packages with yum avoiding using –nogpgcheck key.

Example: Building conky with nvidia support (file names and architectures might differ, use with care).

yumdownloader --source conky
rpm -ihv conky-1.8.1-1.fc13.src.rpm

Edit .spec file:

gedit ~/rpmbuild/SPECS/conky.spec

Search for just two lines, replace  “Release: 1%{?dist}” with “Release: 1%{?dist}_alec” , replace “%{!?with_mpd: –enable-nvidia} \” with “–enable-nvidia \“, save.

Build and install.

rpmbuild -ba --target=x86_64 ~/rpmbuild/SPECS/conky.spec
sudo yum -y install ~/RPMS/x86_64/conky-1.8.1-1.fc13_alec.x86_64.rpm


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.