I am installing a debian package using dpkg-deb on Ubuntu 20.04.3 LTS (64-bit). I want to install it in a specific directory, called software. Inside this directory I have already the bin, the share, the include, the lib directories.

Here's how I tried to install the package:

wget http://ftp.br.debian.org/debian/pool/main/c/curl/libcurl4_7.74.0-1.3+b1_amd64.deb
dpkg-deb -x libcurl4_7.74.0-1.3+b1_amd64.deb /gpfs/software

The /gpfs/software directory is the one where I want to install it. The result of this operation is an error-less installation. However, it creates a directory named usr contained inside the software directory. Inside usr, you'll find lib and share which I already have inside `software. Like this:

└── software
    ├── bin
    ├── include
    ├── lib
    ├── share
    │   └── man
    └── usr
        ├── lib
        └── share

My question is: how can I tell dpkg-deb to put the contents of software/usr/lib and of software/usr/share inside software/lib and software/share?

  • 1
    You haven't provided any OS & release, however downloading and install packages built for Debian on a Ubuntu system, can be like asking for problems. You also highlight many version of python that aren't standard versions used by on-topic releases.
    – guiverc
    Oct 4, 2021 at 13:32
  • Please refer askubuntu.com/help/on-topic, Ubuntu and official flavors of Ubuntu (ubuntu.com/download/flavours) are on-topic on this site. The on-topic link provides alternate SE sites for non-Ubuntu OSes.
    – guiverc
    Oct 4, 2021 at 13:34
  • I edited the post.
    – schmat_90
    Oct 4, 2021 at 13:42
  • 1
    You must edit the package's file structure. The file paths are hard-coded in the package's data.tar.xz archive. This is not a trivial task for beginner. Note that this means dpkg will promptly start complaining that the package has been (correctly) tampered with, that you likely cannot upgrade the package (the upgrade will change all the file paths back to normal), and that if you lose that altered package, you won't be able to use dpkg to uninstall the altered package software.
    – user535733
    Oct 4, 2021 at 14:06

1 Answer 1


You cannot tell that. dpkg-deb installs the .deb package according to how it is packaged. It is the packager of the .deb package that decides how files are arranged. You only can decide on the parent directory where it is installed (/gpfs/software in your example).

You would need to repackage the software yourself in a different .deb package in order to change this.

You must log in to answer this question.

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