• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to install an RPM package into a different directory in CentOS/RHEL/Fedora

By admin

Identifying Relocatable Package

Not all RPM packages can be installed into another directory. An RPM package that can be installed into a different directory is said to be relocatable. To check whether a particular package is relocatable, use the command:

# rpm -qpi [rpm package] | head -1

For example, the packages: redhat-lsb-1.3-3.1.EL3.i386.rpm and rsync-2.5.7-5.3E.i386.rpm produces below output:

# 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 states that the redhat-lsb package is not relocatable but rsync is.

Relocating an RPM package

1. Relocating an rpm package allows user to install the rpm package to a different directory than the default. That means you may install the rsync package into a different directory, say /opt using the rpm option –prefix like this:

rpm -ivh --prefix=/opt rsync-2.5.7-5.3E.i386.rpm

2. To verify whether it was indeed 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

3. Now, if the similar process is applied to the redhat-lsb package, this error message will appear:

# rpm -ivh --prefix=/opt redhat-lsb-1.3-3.1.EL3.i386.rpm
error: package redhat-lsb is not relocatable

Final Thoughts

Relocation of packages listed as not relocatable is unsupported by most of the OS vendors like RedHat. Therefore it is advisable to only relocate “relocatable” rpm packages.

Filed Under: CentOS/RHEL 5, CentOS/RHEL 6, CentOS/RHEL 7, CentOS/RHEL 8, Fedora, Linux

Some more articles you might also be interested in …

  1. How to shrink root filesystem on CentOS / RHEL 6
  2. Where to find ASMLib / oracleasm RPMs for CentOS/RHEL, SUSE, OEL
  3. Linux OS Service ‘haldaemon’
  4. Beginners guide to Device Mapper (DM) multipathing
  5. How to disable the default apache “Welcome Page” in CentOS/RHEL 7
  6. How to fix the error “host key verification failed”
  7. –force V/s –nodeps : rpm command options to install or uninstall a package
  8. Linux OS Service ‘hplip’
  9. How to Force ASM to Scan the Multipathed Device First using ASMLIB/oracleasm
  10. How to Install and configure telnet in RHEL / CentOS 5,6

You May Also Like

Primary Sidebar

Recent Posts

  • Oracle Database – Configuring Secure Application Roles
  • Extend rule sets by using factors in Oracle Database Vault
  • What are Command Rules in oracle Database
  • Using Rule Sets in Oracle Database Vault
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary