Install an RPM package into a different directory

In this tutorial, How to install an RPM package into a different directory on Centos.

For example, Install package bind install into another directory /opt/bind.

Using rpm -qi command to check the package have been installed not yet

$ sudo rpm -qi [name-package]

Not all RPM packages can be installed into another directory.

For example, the bind RPM package is not relocatable. You install it then error: package bind is not relocatable

[vagrant@DevopsRoles ~]$ rpm -qpi bind-9.8.2-0.68.rc1.el6_10.1.x86_64.rpm | head -1
Name        : bind                         Relocations: (not relocatable)

Install an RPM package into a different directory.

For example, wkhtmltox RPM package as below

[vagrant@DevopsRoles ~]$ wget

[vagrant@DevopsRoles ~]$ rpm -qpi wkhtmltox-0.12.5-1.centos6.x86_64.rpm | head -1
Name        : wkhtmltox                    Relocations: /usr/local

[vagrant@DevopsRoles ~]$ sudo rpm -ivh --prefix=/opt/wkhtmltox wkhtmltox-0.12.5-1.centos6.x86_64.rpm

Check the result installed wkhtmltox on your system.

[vagrant@DevopsRoles ~]$ tree /opt/wkhtmltox
├── bin
│   ├── wkhtmltoimage
│   └── wkhtmltopdf
├── include
│   └── wkhtmltox
│       ├──
│       ├──
│       ├── image.h
│       └── pdf.h
├── lib
│   ├── ->
│   ├── ->
│   ├── ->
│   └──
└── share
    └── man
        └── man1
            ├── wkhtmltoimage.1.gz
            └── wkhtmltopdf.1.gz

7 directories, 12 files


Thought the article, How to use “Install an RPM package into a different directory” as above. I hope will this your helpful. Thank you for reading the DevopsRoles page!


About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published.

Comment moderation is enabled. Your comment may take some time to appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.