Home / How to install an RPM package into a different directory?

How to install an RPM package into a different directory?

A relocatable RPM package can change its installation path during the setup process. Not all RPM packages can be installed into a custom directory. Use the following command to see if a specific package can be relocated.

# rpm -qpi <rpm package> | grep Relocations To check rpm packages, centos-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 | grep Relocations Name        : redhat-lsb                   Relocations: (not relocatable) # rpm -qpi rsync-2.5.7-5.3E.i386.rpm | grep Relocations Name        : rsync                        Relocations: /usr

According to the aforementioned instances, rsync is relocatable, but the centos-lsb package is not. This means that you can use the rpm option –prefix to install the rsync package into a separate directory, such as /opt:

# rpm -ivh –prefix=/opt rsync-2.5.7-5.3E.i386.rpm To verify whether the rpm package is installed in /opt, use the command rpm -ql rsync. Below is a sample 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 CentOS / AlmaLinux does not support relocating packages marked as not relocatable. CentOS thus only supports the relocation of relocatable packages.

Purchase Dedicated Servers

Select, configure, and buy!

Click Here

Leave a Reply