7

I would like to know how to install .deb packages without using a package manager such as dpkg. Is it possible to do this? What files do I have to edit? Or is there a unique procedure for each package?

1
  • The disadvantage of doing this (not using a package manager) is that you will have to track down and install any dependencies manually and, depending on where you obtained the .deb, you could cause breakage (if you obtained a package from outside of the Ubuntu repositories). There is a nice, short discussion of the advantages of a package manager here fedoraproject.org/wiki/Package_management_system It is written for fedora, but applies to any distro that uses a package manager.
    – Panther
    Mar 7, 2012 at 22:39

2 Answers 2

5

You can unpack a .deb package using

ar x your_package.deb

Every .deb package contains the two files control.tar.gz and data.tar.gz.

data.tar.gz contains all the program's files.

control.tar.gz contains the metadata and some scripts: preinst is run by dpkg before unpacking data.tar.gz, postinst after unpacking. When removing a packge prerm is run before the program files are removed and postrm after that.

Quite likely this scripts don't work on a Non-Debian system but they may contain code you need to run to make the program work.

Why do you want to do this?

4
  • Thanks for the answer. As for why, it is partly out of curiosity, partly because I want to know how to manage packages if I find myself in a system with no GUI, no internet access, and dpkg popping up errors every time I try to use it.
    – fouric
    Mar 7, 2012 at 22:51
  • I want to install Debian/Ubuntu on HP mini without CD ROM and have difficulties connecting to network due missing Broadcom wi-fi drivers. Few installation environments I tried do not have dpkg or other such tools and I had to manually unpack .deb file and run step-by-step tasks in preinst script.
    – ssasa
    Mar 1, 2014 at 12:29
  • 2
    Everyone always asks for a reason why... What if knowledge is it's own reward? Perhaps one wishes to learn the basics of package managers and seeks to create one for one's self? The reason why doesn't matter in the least unless one is working in a commercial environment and has policy to follow.
    – Yokai
    Mar 30, 2018 at 11:29
  • 1
    Asking "why?" may sometimes give more contextualization about the original intent, which may lead to a more suitable solution. Sometimes, it may be just out of curiosity...
    – Ricardo
    Apr 28, 2020 at 0:27
3

Why do you need to do this?

The .deb file contains files to be unpacked in specific locations in the filesystem, including configuration files, and some scripts to be executed before and after installation, upgrading and removal of the package. Failure to run the appropriate steps will result in a borked installation, which will be really hard to revert if the files are not under package manager control. Also, running the scripts may require some environment that's set up by the package manager and that may be quite difficult to replicate by hand.

That said, you can unpack a .deb file by hand:

ar x file.deb

this will leave three files: control.tar.gz, data.tar.gz and debian-binary. The two tarballs contain the control files, checksums and scripts (control.tar.gz) and the actual files to be unpacked on the filesystem (data.tar.gz). You may be able to get what you need by unpacking and analyzing these files.

Read more about the .deb package format here: http://en.wikipedia.org/wiki/Deb_%28file_format%29

But to stress the point again, this is not really recommended and you stand a high chance of ending up with a borked install.

You must log in to answer this question.

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