How to install a package using rpm command by skipping rpmdb?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 5,6

Issue

  • How to install a package using rpm command by skipping rpmdb?

Resolution

Below method is not officially supported by Red Hat. This can cause accidental overwriting of files. Please use with caution.

--dbpath can be used to specify an alternate rpmdb directory.

For example,

First create a directory..

# mkdir /root/rpm

Run rpm command using --dpath. It will show lots of dependency errors, as the dependencies cannot be found in the new rpm directory.

# rpm -ivh --dbpath /root/rpm hangwatch-0.3-5.noarch.rpm 
error: Failed dependencies:
    /bin/bash is needed by hangwatch-0.3-5.noarch
    /bin/sh is needed by hangwatch-0.3-5.noarch
    /sbin/chkconfig is needed by hangwatch-0.3-5.noarch
    /sbin/service is needed by hangwatch-0.3-5.noarch
    libc.so.6 is needed by hangwatch-0.3-5.noarch
    libc.so.6(GLIBC_2.0) is needed by hangwatch-0.3-5.noarch

So following command with --nodeps can be used to install the file.

# rpm -ivh --dbpath /root/rpm hangwatch-0.3-5.noarch.rpm --nodeps
Preparing...                ########################################### [100%]
   1:hangwatch              ########################################### [100%]

Installed package cannot be seen in the rpm database.

[root@prod231-203 ~]# rpm -qa|grep hang
[..]

from 'man rpm'

       --dbpath DIRECTORY
              Use the database in DIRECTORY rather than the default path /var/lib/rpm

       --nodeps
              Don’t do a dependency check before installing or upgrading a package.
  • Component
  • rpm

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments