I am running Debian jessie stable in order to understand how the .deb package interacts with the system. What is the correct way to extract and install a packge_name.deb without the command dpkg?
- 66,199
- 35
- 114
- 250
- 63,407
- 31
- 131
- 192
-
It would be unusual to want to do that and unlikely that dpkg it not present - so can you explain a little more about why you're trying to do this? – EightBitTony May 10 '16 at 11:14
-
I need to to know how the .deb package interact with the system – GAD3R May 10 '16 at 11:18
-
1Then you would have to read the control file and the content of the data archive and work it out. See my answer for getting to that content. – EightBitTony May 10 '16 at 11:19
-
1Possible duplicate of [How it is possible that dpkg isn't neccesary for installing deb packages?](http://unix.stackexchange.com/questions/146848/how-it-is-possible-that-dpkg-isnt-neccesary-for-installing-deb-packages) – Stephen Kitt May 10 '16 at 11:28
-
2I see the connection @StephenKitt but I'm not sure it's a true duplicate. – EightBitTony May 10 '16 at 11:46
-
1@EightBitTony, the nice thing about suggesting a duplicate is that it puts it up for a vote ;-). I agree it's debatable whether this is a duplicate; I found the linked question and answers interesting because they include links to all the necessary information (including how to properly install a `.deb` package without `dpkg`, which *is* possible albeit difficult). – Stephen Kitt May 10 '16 at 11:49
-
@StephenKitt yep, agreed on all counts. – EightBitTony May 10 '16 at 12:56
2 Answers
You can unpack .deb files using the ar command (since .deb files are ar archives).
ar x file.deb
will start the process. That will give you three files,
- debian-binary
- control.tar [or similar]
- data.tar [or similar]
The last two contain control metadata and then the actual package files and are tar archives (which may be compressed using gzip, bzip, etc.)
You would be able to extract the control data, and the actual content from the last two files, and then in theory, copy the files to the correct places, but it would be non-trivial.
The data archive contains the install scripts, so that would be a good place to start when looking for how it interacts with the system.
I don't think there is a correct way to install a .deb file without using dpkg.
- 20,963
- 4
- 61
- 62
-
Yeah, there is a lot missing to this. For example, you have to manually modify /var/lib/dpkg/status to mark the package as having been installed. – Paul Knopf Nov 22 '19 at 01:58
The files themselves can be installed with this command. You might need ar instead of tar.
tar xOf my_package.deb data.tar.gz | sudo tar xzpomv
This works if the package does not require any logic, typically standalone applications that just install everything under /opt/.
Otherwise you can also have a look at the metadata (control file) and scripts, if any:
tar xOf my_package.deb control.tar.gz | tar xv
- 121
- 2
-
The package may not be using gzip for compression (others are supported as well) so these commands are not universal. – Tyler Kropp Jun 23 '23 at 14:11