Setting up an environment for building RPMs

RHEL or CentOS systems

Users of these systems can run the following command to set up their environment:

$ rpmdev-setuptree                                   # Creates ~/rpmbuild and ~/.rpmmacros

SLES systems

Users of these systems can run the following command to set up their environment:

$ mkdir -p ~/rpmbuild/{BUILD,RPMS,S{OURCE,PEC,RPM}S} 
$ echo "%_topdir $HOME/rpmbuild">  ~/.rpmmacros