Je t’embrasse Salutations from Silicon Valley, California

6Nov/130

Local rpmbuild directory

Just so I don't forget this for the 26th time...

Typically, when you install a source RPM, it unpacks the source code in some location like "/usr/src/redhat". Unfortunately if you are not root, and do not have sudo permissions, you just don't have access to that directory. So instead, it would be helpful to have the ability to do any RPM building in a user-local directory... like "~/rpmbuild".

To do this, all you have to do is make the directory:

[jjinno@localhost ~]$ mkdir -p ~/rpmbuild

And then create yourself a file called "~/.rpmmacros" with the following contents:

%_topdir %(echo $HOME)/rpmbuild
.%_smp_mflags -j3

And that's it!

Now when you run and RPM install of some source RPM, it will install the source code to "~/rpmbuild/SOURCES" and there will be an rpmbuild SPEC file located in "~/rpmbuild/SPECS". Simply change directory over to the SPEC file, and run your rpmbuild. (NOTE: just cause installing the source doesn't require root permissions does not necessarily mean that compiling the source will work without them)

Filed under: Linux No Comments