# yum install rpm-build redhat-rpm-config pinentry-gtk.x86_64 # adduser build # sudo su – build $ mkdir -p -m 700 ~/.gnupg $ gpg-agent –daemon –use-standard-socket –pinentry-program /usr/bin/pinentry-curses Do export the output from this line If don’t have key yet: gpg –gen-key On Centos6, if you find gpg-agent[1783]: command get_passphrase failed: Operation cancelled gpg: cancelled by user Login directly to the box using build, do not use sudo and generate again the key. If asked for random keyboard or mouse, do generate random with other shell: $ sudo rngd -r /dev/urandom $ mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} Create a file called .rpmmacros that contains something like below:
$ cat .rpmmacros %_topdir %(echo $HOME)/rpmbuild %_signature gpg %_gpg_path %(echo $HOME)/.gnupg %_gpg_name F77xxxxx %_gpgbin /usr/bin/gpgYou can get the F77xxxx from the gpg list key:
$ gpg --list-keys /home/build/.gnupg/pubring.gpg ------------------------------ pub 20172K/F77xxxx 2011-11-05 uid Build SystemWhen ready, put your rpm source inside SRPMS and install it.
rpm -Uvh package.src.rpmEnter SPECS folder and rebuild:
rpmbuild -bb --sign yourpackage.specThen check and look for RPM inside RPMS folder. To create public key
$ gpg --armor --exportTo check your public GPG key:
www.pgpdump.net]]>