How do I install an RPM package into a different directory?

by on January 26, 2008 · 4 comments· LAST UPDATED March 26, 2008

in , ,

Q. How do I install an RPM package into a different directory like /home/chroot under RHEL / Fedora / CentOS Linux server?

A.An RPM package that can be installed into a different directory is said to be relocatable. The --prefix NEWPATH option is used for for relocatable binary packages. It translate all file paths that start with the installation prefix in the package relocation hint(s) to NEWPATH. For example, package bind-chroot or rsync or bash can be installed into another directory called /opt or /home/chroot. First find out whether a particular package is relocatable or not using rpm -qi command itself:
$ rpm -qi {package-name}
To install an RPM package into a diffrent directory type:
# rpm --prefix=/home/chroot/ bind-chroot*.rpm
To verify package file listing enter:
# rpm -ql bind-chroot

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 4 comments… read them below or add one }

1 Reynold September 6, 2011 at 3:58 am

Thanks for the post Vivek:)
It would be great if you could include the relocation concept in debain packages also ….

Reply

2 tahir April 30, 2012 at 8:21 am

sir how i convert a folder because in that folder there is exe files so i convert it into rpm form to install that through rpm….. rply

Reply

3 Sanjith November 27, 2012 at 12:37 pm

how do i remove the packages installed with –prefix directory?
plz help

Reply

4 Felipe August 28, 2014 at 2:15 pm

# rpm –prefix=/opt/tomcat -ivh tomcat-7.0.42-8.el7_0.noarch.rpm
error: package tomcat is not relocatable

Reply

Leave a Comment

Tagged as: , , , , , , , ,

Previous Faq:

Next Faq: