1

How query custom installed rpm package

Generally if i need to query rpm based package I use following commands

rpm -qi package

rpm -ql package        # to get installed binaries of package

rpm -qf path to binary # to get related package name of the path 

All above mentioned commands work very well with all the installed packages, but problem raised when I have installed package in custom location using following commands

rpm –prefix=/opt -ivh package

rpm -relocate=/opt  -ivh package

So when I used above mentioned commands package got installed properly but I was not able to use following rpm query commands

rpm -qi package

rpm -ql package       # to get installed binaries of package

rpm -qf path to binary # to get related package name of the path 

Is there a way I can query custom installed rpm package?

2 Answers 2

2

After looking at your comments, you may want to try:

rpm -qi --root=/opt atop

When you use the --installroot flag for yum, it uses or creates a new rpm database in that location. When you run rpm without the --root flag it will look at the default rpm database in /var/lib/rpm which does not have any knowledge of your custom package install.

1
  • worked for me @GracefulRestart Oct 24, 2018 at 18:45
0

This question looks to be similar to yours. If you have rpm file please check

rpm -qp /path/to/your/package.rpm

to see if the package has another name than rpm file.

3
  • thanks for quick response Let me elaborate my question Oct 23, 2018 at 20:21
  • thanks for quick response Let me elaborate my question Case 1 : yum install atop [root@host ~]# rpm -qi atop Name : atop Relocations: (not relocatable) Version : 1.27 Vendor: Fedora Project Release : 2.el6 Build Date: Thu 16 Jan 2014 Case 2 : yum install atop --installroot=/opt [root@cl14470 ~]# rpm -qi atop package atop is not installed In case 2 rpm related query commands are not working, I am looking for a way to query custom installed rpm Oct 23, 2018 at 20:28
  • Looks like your package is not installed in fact. Relocations: (not relocatable) states that the package cannot be relocated using --prefix. You have to receive an error on output when run yum install atop --installroot=/opt.
    – Zalatik
    Oct 23, 2018 at 22:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .