Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My task is to setup a RHEL 5.x build host, that can build RPMs for mortal users.

On RHEL 6.x with rpm version 4.8, I have in /usr/lib/macros:

#       Path to top of build area.
%_topdir                %{getenv:HOME}/rpmbuild

On RHEL 5.x with rpm version 4.4, the %{getevn:HOME} is not available.

I know that I can use /home/someuser/.rpmmacros:

%_topdir                /home/someuser/rpmbuild

and this will work for that user, however I don't want to do this for every user separately. Moreover, since .rpmmacro will not expand ${HOME} or ~ I suspect it is unsafe to use those. This in turn make /etc/skel unstable for this task (or so I suspect).

So in short, my question is: How to setup RHEL 5.x host that allow all users to build RPM packages in their home directory?

share|improve this question
up vote 2 down vote accepted

In my .rpmmacros on RHEL5 I use

%_topdir        %(echo ${HOME}/rpm)

If you don't want to set up mock (but I too recommend doing that) this might help.

share|improve this answer
This solves my problem with minimal additional noise to the system. – Chen Levy Sep 4 '12 at 8:40

If at all possible, make your build server EL6. This will save you a lot of hassle later...

For a simple build box where only the occasional RPM package will be built, have your users use mock. You'll find it in the EPEL repository.

Using mock to build an RPM ensures that all of the correct build dependencies have been specified by building it in a chroot environment.

Add users who should be able to access mock to the mock group.

Then these users can build an RPM with a command like:

mock -r epel-5-x86_64 file.src.rpm

If you need to build a lot of RPMs, or you're creating a repository, you may want to set up an automated build server with something like koji.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.