RPM relocatable packages

Thursday, June 18th, 2009

RPM has an option (–prefix) that allows users to install rpms in other directories than the default ones.
Packages that allow to be installed in other directories are called : relocatable

[root@localhost gcc]# rpm -qpi libxslt-1.1.24-4.fc11.i586.rpm | grep Relocations
Name : libxslt Relocations: /usr
[root@localhost gcc]# rpm -qi libxslt | grep Relo
Name : libxslt Relocations: /usr

So basically you can install this package in other directory.

[root@localhost gcc]# rpm -ihv libxslt-1.1.24-4.fc11.i586.rpm –prefix $PWD –force
Preparing… ########################################### [100%]
1:libxslt ########################################### [100%]
[root@localhost gcc]# ls
bin lib libxslt-1.1.24-4.fc11.i586.rpm share

For example gcc is not relocatable and installing it in an different directory is not allowd:

[root@localhost gcc]# rpm -qi gcc | grep Relo
Name : gcc Relocations: (not relocatable)
[root@localhost gcc]# rpm -Uhv gcc-4.1.2-33.i386.rpm –prefix=$PWD
error: package gcc is not relocatable