How to install *.deb package using Dpkg to specific directory.

Solution 1:

dpkg-deb -x $DEBFILE $TARGET_DIRECTORY

# Example 
dpkg-deb -x somedeb.deb /home/yung/test

Source

Solution 2:

A .deb is just an archive, like a zip file

You can manually extract it ; https://www.cyberciti.biz/faq/how-to-extract-a-deb-file-without-opening-it-on-debian-or-ubuntu-linux/

sudo apt install binutils

ar x your.deb

You then extract the .tar or whatever is in the .deb

tar xvf control.tar.gz
tar data.tar.gz

You can then manually copy the files to wherever you wish, I would use /usr/local so they are on your path, up to you.

You may need to read / run the config files and install scripts as well, cant say from what you have posted.

Solution 3:

There is no need to extract the package contents of these two packages, only because they are dependent on each other.

Just give both packages at once when installing

dpkg -i libidb-0.12.0-0b81d72-0.amd64.deb python-idb-<version>.amd64.deb

Solution 4:

In all other answers recommending decompressing archive -- that is not the same as installing! One of the notable differences is that postinst script is not run when using -x. The only satisfactory answer to the OPs question is this option, straight from man pages:

       --instdir=dir
              Change default installation directory which refers to the
              directory where packages are to be installed. instdir is also the 
              directory passed to chroot(2) before running package's installation 
              scripts, which means that the scripts see instdir as a root
              directory.  (Defaults to «/»)