Skip to content

Instantly share code, notes, and snippets.

@stahnma
Created February 1, 2013 01:58
Show Gist options
  • Save stahnma/4688565 to your computer and use it in GitHub Desktop.
Save stahnma/4688565 to your computer and use it in GitHub Desktop.
Hacky way to use already made RPMs as a non-root user.
You actually may have an option. It's dirty, and here be dragons. I
know this from working on RPM on AIX, so again, it's hacky. I did this
on a CentOS 6.3 box for my example, should work on Fedora.
You can do something like:
ls zip-3.0-1.el6.x86_64.rpm
mkdir $HOME/.myrpm
cp -pr /var/lib/rpm/* $HOME/.myrpm/
chown -R $USER $HOME/.myrpm/
rpm -Uvh --justdb --dbpath $HOME/.myrpm zip-3.0-1.el6.x86_64.rpm
rpm2cpio < zip-3.0-1.el6.x86_64.rpm | cpio -idmv
rpm -q --dbpath $HOME/.myrpm zip
Results:
[vagrant@localhost ~]$ rpm -q --dbpath /home/vagrant/.myrpm zip
zip-3.0-1.el6.x86_64
[vagrant@localhost ~]$ rpm -q zip
package zip is not installed
You now have zip installed (and rooted) in $HOME. You'd have to add
the --dbpath option to rpm any time you used it, and it would get out
of sync with the system rpm database unless you wrote some tooling
around that. But it's completely do-able.
Again, it's ugly and I don't recommend it.
@robbyt
Copy link

robbyt commented Feb 1, 2013

wow!
great hack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment