possible to install an rpm in user space?

Stuart D Gathman stuart at bmsi.com
Fri Nov 5 03:30:37 UTC 2010

On 11/04/2010 09:54 PM, David Burns wrote:
> Not sure how to make it more clear - I want to pop open an rpm and put
> all the files somewhere so that I can execute the code (given
> appropriate PATH etc. environment variables) without ever using root
> privilege or touching any of the sensitive shared directories where
> stuff usually gets put in an ordinary install. It should all end up in
> my home directory or /tmp, someplace where no other user of that
> machine would accidentally execute it. Sort of as if I had compiled it
> in my own home directory from scratch. Any dependencies that were
> already satisfied would just use the shared instances in the standard
> locations, since there's no need to change them. But if additional
> rpms needed to be found & installed, they also would need to be
> installed in my user space so they don't tromp existing stuff.
>> you might try the --relocate option.
> Thanks for the hint, that sounds like a starting point.
>> Not all RPMs are relocatable, though.
> Hmmm.... I guess if I was more familiar with RPMs I'd be able to think
> of better examples. Okay, I am too new.
>> Another option is to unpack the
>> RPM using rpm2cpio [1].
> That also looks promising.
> It seems to me that this should be automatable, maybe there's just no
> demand for it? I am frequently wanting to try out some rpm not built
> for my exact system or a newer rev without trampling the existing
> installs.
> Maybe building my own binary rpm from a source rpm is what I really
> ought to be looking at?
It is a decent idea.  First, without root, you can't update the rpm
database.  And you probably don't want to for this application.  You
would need your own rpmdb in your home directory.  the --dbpath option
can accomplish that.  Then, the rpm would need to be for software that
needs no root privilege in operation.  I.e. sendmail wouldn't work, but
python might.  Then, the rpm needs to be relocatable.  Finally, rpm
should check the system rpm database in read-only mode for system
dependencies.  It doesn't have that feature, but you could copy the
system data to your home directory database at startup.  That wouldn't
keep your home copy updated as the system is updated, however. 

All rpm would need is an option for an alternate dbpath to check in
read-only mode, and your idea would then just need relocatable packages
capable of running in a user homedir.  It really is a worthwhile idea -
how to drum up interest?  Has it been considered and discarded for
reasons I haven't thought of? 

More information about the Rpm-list mailing list