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

16,210

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 «/»)
Share:
16,210

Related videos on Youtube

Sumit Kumar Suman
Author by

Sumit Kumar Suman

Updated on September 18, 2022

Comments

  • Sumit Kumar Suman
    Sumit Kumar Suman over 1 year

    I have to install two packages (libidb and python-idb and both are depended to each other ) from third party.So,we can not get access of source code. I have tried with these following method to install and i got error also:

    > > sumitkumars@administrator-Lenovo-U410:~$ sudo dpkg -i libidb-0.12.0-0b81d72-0.amd64.deb --instdir=/home/sumitkumars/mydir
    > [sudo] password for sumitkumars:  (Reading database ... 186372 files
    > and directories currently installed.) Preparing to unpack
    > libidb-0.12.0-0b81d72-0.amd64.deb ... Unpacking libidb (0.12.0) over
    > (0.12.0) ... dpkg: error processing archive
    > --instdir=/home/sumitkumars/mydir (--install):  cannot access archive: No such file or directory Setting up libidb (0.12.0) ... Errors were
    > encountered while processing:  --instdir=/home/sumitkumars/mydir
    

    then i tried with this:

    sumitkumars@administrator-Lenovo-U410:~$ sudo dpkg-deb -x libidb-0.12.0-0b81d72-0.amd64.deb /home/sumitkumars/mydir/
    

    It is not giving error but it was not working with its another depency(python-idb)

    I have added python also because it is unable to bind with "libidb".

  • Videonauth
    Videonauth over 6 years
    wouldn't it be better to use dpkg-deb for unpacking packing .deb files since it doesn't need to have something new to be installed?
  • Panther
    Panther over 6 years
    I am neutral on that ;)
  • Sumit Kumar Suman
    Sumit Kumar Suman over 6 years
    @Panther Thanks ,do i have to bind two library if both(libidb and python-idb) are complement to each other.
  • Panther
    Panther over 6 years
    @SumitKumarSuman I do not know I am not familiar with your package.
  • dimir
    dimir about 4 years
    This is not what's asked.
  • Olaf Dietsche
    Olaf Dietsche about 4 years
    @dimir Yes, this is not an answer to the question. But it is a solution to the problem of installing dependent packages.
  • Macspider
    Macspider over 2 years
    This works to some extent, but creates a dir named "usr" inside /home/yung/test which then contains lib and share. If your lib and your share directories are inside $TARGET_DIRECTORY, this won't work.
  • mirni
    mirni about 2 years
    Decompressing is not the same as installing, e.g. postinst, prerm etc scripts are not run. Using --instdir=/path/to/root is the correct answer.