Setting up an RPM build environment in the home directory of a non-root user:

Suppose we need to build some RPMs , not as root, but as a normal user, e.g. kamran. Example of such software would be Courier-IMAP server. Kamran’s home directory is /home/kamran . We would need to do the following simple steps:


mkdir $HOME/rpm/RPMS/{i386,noarch,x86_64}

echo "%_topdir $HOME/rpm" >> $HOME/.rpmmacros

That’s all. For an example software like Courier-IMAP build, you would now be using the same rpmbuild command, with the following results:

[kamran@server ~]$ rpmbuild -ta courier-imap-4.5.0.tar.bz2



Wrote: /home/kamran/rpm/SRPMS/courier-imap-4.5.0-3.src.rpm

Wrote: /home/kamran/rpm/RPMS/x86_64/courier-imap-4.5.0-3.x86_64.rpm

Wrote: /home/kamran/rpm/RPMS/x86_64/courier-imap-debuginfo-4.5.0-3.x86_64.rpm

Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.72263

+ umask 022

+ cd /home/kamran/rpm/BUILD

+ cd courier-imap-4.5.0

+ rm -rf /var/tmp/courier-imap-4.5.0-3-buildroot

+ exit 0

[kamran@server ~]$