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

Posted on in Categories , , , last updated March 26, 2008

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

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

5 comment

Leave a Comment