Install RPM to a Different Directory (relocatable)

In this tutorial, we learn how to install rpm installation into a specific directory. For that to happen, rpm package should be relocatable.

If that package is not flexible enough (--prefix path can't be set) to be installed in to a different locations as provided by the user or it's hardcoded, examples are like bash shell package or flash packages, which may not be relocatable.

Not relocatable Package

Let me start with examples where the rpm package is not relocatable, ie cannot install into a specific directory.

$sudo rpm -qpi /home/redhat/Downloads/flash-plugin-
Name : flash-plugin Relocations: (not relocatable)
Version : Vendor: Adobe Systems Inc.
Release : release Build Date: Fri 10 Aug 2012 06:45:38 PM PDT
Install Date: (not installed) Build Host:
Group : Applications/Internet Source RPM: flash-plugin-
Size : 18383579 License: Commercial
Signature : (none)
Packager : Adobe Systems Inc.
Summary : Adobe Flash Player 11.2
Description :
Adobe Flash Plugin
Fully Supported: Mozilla SeaMonkey 1.0+, Firefox 1.5+, Mozilla 1.7.13+

So the above package is not relocatable and it can’t be installed in a custom location.

You can also try below command to find whether the package is relocatable

$sudo rpm –qi [package_name] | grep Relocations

If the package is relocatable it might show in the output as below

Name : keyutils-libs Relocations: /opt

Install package to a different directory

If the package is relocatable, it can be installed to a different location with --prefix path.

$sudo rpm --prefix=/mnt gnome-backgrounds-2.28.0-2.el6.noarch.rpm


In this tutorial, we learned how to install rpm package in a specific directory. If you have any questions or feedback, feel free to leave a comment.

Leave a Comment