Local installation of package in Red Hat / Fedora Linux

Hi all,

I have a requirement to install rpm package(*noarch.rpm) in local to a directory, ex /tmp/mydir.

which steps I need to follow to install rpm package local to the directory only, not to the default directories.

Please share me the link if the topic is already discussed. I tried few forums, couldnt get right direction.

Thanks,

Hi,

Firstly, not all RPM packages support re-location. The package maintainer has to have designed the package to permit this. Typically many do not, since the software in the package has been compiled with a particular installation path in mind. But if your package is re-locatable this should be fairly simple, and doable with a command like:

rpm --prefix=/path/to/new/root/ -ivh package.rpm

This would install the package package.rpm underneath the directory /path/to/new/root/ , as opposed to underneath / as normal.

If your package is not re-locatable, then you could always just convert the RPM to a cpio archive and manually extract it. Create a directory to extract the contents in, move your RPM in there, and do something like:

rpm2cpio package.rpm | cpio -div

This would extract the cpio archive inside the RPM underneath the current working directory. Note that of course this is just going to extract the software and you will ultimately have hte same problem - if the package is not meant to be re-located to somewhere else, it's not going to work in a new location.

If you absolutely need to re-locate a package that's not re-locatable, then you could always download its source code and configure it with your desired installation prefix, and compile and install it there.

Hope this helps.

I tried rpm2cpio package.rpm | cpio -div and corresponding files got created. I am planning to install erlang, planning to figure out where to take from here. what command I should run against bin.

Hi,

I'm not 100% sure what you mean, sorry. The package will have had its files extracted underneath wherever you ran the cpio command. You might be able to just run /path/to/wherever/bin/whatever and it might just work, but equally it may not. As I mentioned previously, many packages are not designed to be re-locatable, and might misbehave or fail in unexpected ways as a result of not having their binaries, libraries and other support files in the locations they expect to find them. I'm not myself familiar with Erlang at all, so can't really give any package-specific advice here.

If it comes to it, then as I say you can always download the source of the package (assuming it has source code available, almost all packages do generally speaking) and compile it yourself, specifying exactly the directory you want to install the resulting binaries in. You don't normally have to be root or need to have sudo access to compile most things, if user permissions and access rights are ultimately your real problem here.