Q. Can you explain CentOS / RHEL / Fedora Linux relocatable package concept?
A. RPM has the ability to give users some latitude in deciding where packages are to be installed on their systems. However, package builders must first design their packages to give users this freedom. In other words, an RPM package that can be installed into a different directory is said to be relocatable. Please note that not all RPM packages can be installed into another directory.
Task: Find out if whether a particular package is relocatable or not
Use rpm command as follows:
$ rpm -qi {package-name} | grep Relocations
$ rpm -qpi package.file.rpm | grep Relocations
$ rpm -qi bash | grep Relocations
Sample output (it means bash package can be installed in diffrent directory such as /home/chroot/users/):
Name : bash Relocations: /usr
Following package is not relocatable:
$ rpm -qi keyutils-libs | grep -i Relocations
Output:
Name : keyutils-libs Relocations: (not relocatable)
Task: Install package into a different directory
rpm command has –prefix option. It allows to install package in diffrent directory. For example, install bash into /opt directory:
# rpm --prefix=/opt bash*.rpm
See also:
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 4 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
i was a study to rhce
Explain vi editor options for text formatting.
Thanks for the post Vivek:)
One question if you don’t mind. Is it possible to convert a non-relocatable rpm to a relocatable one?
I was able to install a non-relocatable package to a non-standard location with rpm. The details are provided below,
—————————————————————————–
[root@mail2 ~]# rpm –prefix=/mail/mysql -i mysql-server-5.0.77-4.el5_6.6.x86_64.rpm
error: package mysql-server is not relocatable
[root@mail2 ~]# rpm –relocate /=/mail/mysql/ –badreloc -ivh mysql-server-5.0.77-4.el5_6.6.x86_64.rpm
Preparing… ########################################### [100%]
1:mysql-server ########################################### [100%]
error reading information on service mysqld: No such file or directory
/bin/chmod: cannot access `/var/lib/mysql’: No such file or directory
[root@mail2 ~]# echo $?
0
[root@mail2 ~]#
—————————————————————————–
Do you think there is any possible issues with the above procedure?
the problem using relocate options is explained here: http://rpm5.org/docs/api/relocatable.html