building rpms without being root

I got tired of having to become root to install a src.rpm and to build it. Turns out a little magic in $HOME/.rpmmacros will do the trick. Do the following:


mkdir -p $HOME/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo "%home %(echo $HOME)" >> $HOME/.rpmmacros
echo "%_topdir %{home}/rpmbuild" >> $HOME/.rpmmacros

Now when you install a src.rpm it will go to $HOME/rpmbuild/ instead of /usr/src/redhat/.

That’s it.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s