• 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 enable the automatic extension for a thin LVM volume
  2. How To Enable PHP 7.0 And httpd24 On Oracle Linux 7
  3. How to (Correctly) Change the UID and GID of a user/group in Linux
  4. CentOS / RHEL 7 : How to Change the machine-id
  5. “su: Authentication failure” – in Docker
  6. How To Force User/Group Ownership Of Files On A Samba Share
  7. Understanding Variables in Bash Shell Under Linux
  8. CentOS / RHEL 6,7 : Why the files in /tmp directory gets deleted periodically
  9. How to Convert Ext File Systems to Btrfs
  10. Starting iptables Fails with Error “Another app is currently holding the xtables lock”

You May Also Like

Primary Sidebar

Recent Posts

  • How to disable ACPI in CentOS/RHEL 7
  • How to Use real-time query to access data on a physical standby database
  • CentOS/RHEL 8: “ACPI MEMORY OR I/O RESET_REG” Server Hung after reboot
  • How to Create a Physical Standby Database by Using SQL and RMAN Commands
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary