8

I've downloaded an RPM from Oracle that wants to install in /usr, and due to the way our SysAdmins set up our workstations, I don't have enough disk space in /usr. Most of the space on the root partition, where /usr is located, is occupied by /usr/lib and /usr/lib64, and I cannot really go in there and clean up much.

Is there a way to redirect the RPM install to another path, like /opt or /home/oracle?

3 Answers 3

11

Well, yes, sort of:

--relocate OLDPATH=NEWPATH

For relocatable binary packages, translate all file paths that start with OLDPATH in the package relocation hint(s) to NEWPATH.

(man rpm).

However, the software may have its usual install location hardcoded in various places. If an RPM was not meant to be relocated like this (note the "For relocatable binary packages"), this will probably not work.

In that case, your best bet is probably to unpack the RPM manually (rpm2cpio package.rpm | cpio -di in a temporary directory), then manually put stuff where it should go.

Most of all, loudly complain to the admin who did the problematic partition layout. On modern Linux systems, there is little reason for separate partitions. Usually / and /boot are enough...

1
  • 2
    Thanks! I have and will continue to complain to the admins. They think 10G for the root partition is plenty...never mind how often I have to clean up all of the corporate logging crap in /var....
    – Dr. Watson
    Jul 6, 2010 at 15:06
1

There is another method that works with non-relocatable packages. Check the path where the files that take the most disk space are located, using this command:

rpm -qpl package.rpm

Example output:

/u01/file1
/u01/file2
...

Create a symbolic link with the name of that directory, pointing to a directory with more free disk space

mkdir /var/lots_of_space
ln -s /var/lots_of_space /u01

And then install the usual way:

rpm -i package.rpm
0

You can use rpm -i --relocate OLD=NEW --badreloc package-1.0.elX.rpm

This will force non-relocatable packages into a new location. OLD will likely be /, and NEW would be your intended destination (/opt, for example).

Without the '--badreloc', you will likely get "package X is not relocatable".

Chuck

Edit: This has been tested on RHEL 6.10 and 8.3.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .