TEXT
72
rpm change path
Guest on 1st June 2022 01:49:47 PM
Install the RPM package to the specified directory
How to install an RPM package to a different directory?
Solution:
Not all RPM packages can be installed to another directory. An RPM package that can be installed into a different directory is relocatable. To check if a package can be relocated, use this command:
rpm -qpi rpm-package | head -1
For example, these two packages: redhat-lsb-1.3-3.1.EL3.i386.rpm and rsync-2.5.7-5.3E.i386.rpm
# rpm -qpi redhat-lsb-1.3-3.1.EL3.i386.rpm | head -1
Name : redhat-lsb Relocations: (not relocatable)
# rpm -qpi rsync-2.5.7-5.3E.i386.rpm | head -1
Name : rsync Relocations: /usr
It can be seen that the redhat-lsb package cannot be relocated, but the rsync package can. This means that you can install the rsync package to a different directory, such as /opt, using the rpm option --prefix, like this:
rpm -ivh --prefix=/opt rsync-2.5.7-5.3E.i386.rpm
To verify that it was actually installed to /opt, use the command rpm -ql rsync. Here is an example output:
# rpm -ql rsync
/etc/xinetd.d/rsync
/opt/bin/rsync
/opt/share/doc/rsync-2.5.7
/opt/share/doc/rsync-2.5.7/COPYING
/opt/share/doc/rsync-2.5.7/README
/opt/share/doc/rsync-2.5.7/tech_report.tex
/opt/share/man/man1/rsync.1.gz
/opt/share/man/man5/rsyncd.conf.5.gz
Now, if I do this with redhat-lsb, I get an error message:
# rpm -ivh --prefix=/opt redhat-lsb-1.3-3.1.EL3.i386.rpm
error: package redhat-lsb is not relocatable