1. Home
  2. Linux
  3. Install a debian package on any linux distribution

How To Install A Debian Package On Any Linux Distribution

Debian packages are the most famous packages in all of Linux. 9 times out of 10 when someone is moving a program over to Linux, they’re putting out as a Debian package i.e., a DEB file. Having Linux support, even if it’s only with one type of Linux distribution is nice. That said, not every Linux distribution is designed to run these packages. In this article, we’ll be going over a fool-proof way to install a Debian package and make the program work on your Linux distribution.

No “converting” will take place in this guide. Instead, just extracting the data and moving it around. To get started, download a Debian package. In this example, we’ll work with the Google Chrome package. Though this guide focuses on the Google Chrome Debian package, it is a proof of concept. Take the method shown here and apply it to install a Debian package.

Extracting Data

Most Linux users don’t realize that DEB packages are just fancy archive files that are extractable. Download the Debian package you want to install and extract it. In this case, we have the Chrome package, downloaded, and extracted on our system. Open up a terminal window and use the mkdir command to make a new folder. This folder will hold all of the package data we need.

mkdir -p ~/deb-extracted

Using mv, put the Chrome file into the new folder.

mv google-chrome-stable_current_amd64.deb ~/deb-extracted

CD into the new folder, and use the ar tool to inspect the Chrome package.

cd ~/deb-extracted

ar tv google-chrome-stable_current_amd64.deb

Ar inspects the Chrome DEB file and lets us know there are three compressed files inside. These files are the “debian-binary”, “control.tar.gz”, and “data.tar.xz”. All the data we need is in the data.tar.xz archive, but “control.tar.gz” is also important.

The Ar tool doesn’t just inspect archives. It can also extract them. Use ar xv to extract the three items out of google-chrome-stable_current_amd64.deb.

ar xv google-chrome-stable_current_amd64.deb

All three items should now be inside ~/deb-extracted. Use the rm command to remove “debian-binary”. It’s not necessary, as we are not using Debian Linux.

From here, we’ll need to extract the file data from data.tar.xz. It contains everything required to run Chrome as a program on Linux. Extract it to the folder with tar.

tar -xvf data.tar.xz

Extracting the data archive will output 3 folders. The folders are “opt”, “usr” and “etc”.

Using rm -rf, delete the etc folder. Items in this folder aren’t needed, as it is a Debian update job to check for updates.

Note: Don’t a / in front of the command below. You might accidentally delete /etc/, and not the etc folder extracted in ~/deb-extracted.

rm -rf etc

Next, move the files inside of usr and opt files to where they belong on the PC. For example, to install Google Chrome on a non-Debian Linux distribution, you’d move the files to where they belong, manually:

cd opt

sudo -s

mv google /opt/

ln -snf /opt/google/google-chrome /usr/bin/

cd .. share

mv -f * /usr/share/

The above example shows exactly what to do with extracted files from data.tar.xz. Obviously, other Debian packages might have contents inside the extracted folder that are different from the ones you see in this tutorial. The idea is to look at the folder names inside of a data.tar.xz archive, and pay attention to the names. The folders inside have the same names as folders on your Linux PC’s filesystem, and the items inside go to those locations.

Finding Package Instructions

Sometimes decompiling a Debian package and extracting the data.tar.xz archive isn’t enough and you’re still left confused. Luckily, each Debian package file comes with a set of instructions. These instructions are inside of the control.tar.gz.

Extract the control.tar.gz archive to the ~/deb-extracted folder with the tar command.

tar -xvzf control.tar.gz

The control.tar.gz archive has a lot of scripts that tell the Debian package what to do. The one we’re interested in is labeled “postinst”. Postinst is short for “post installation”, a bash script that runs and puts everything where it needs to go.

In the terminal use the cat command to view the text file. Combine it with “more” to view it line by line. Inspect the “postinst” file and pay attention to what the script is doing, especially where it’s putting files. This will help you figure out where the items inside data.tar.xz belong, and what they do.

cat postinst | more

Dependencies

Decompiling a Debian package and moving the data files to the right places often isn’t enough. Sometimes, you’ll need to install the right dependency files or nothing works. Luckily, each Debian package has a small file in control.tar.gz, outlining a detailed list of important library files the user must install for everything to work. To view this file, use cat.

cat control | more

For example, to use Google Chrome, the control file asks for ca-certificates, fonts-liberation, libappindicator1, libasound2, libatk-bridge2.0-0, and other items.

Read through this file carefully, and use it to install the individual libraries on your Linux PC. When the correct programs are on your PC, the extracted program should work like normal.

If you’re running a Redhat-based Linux system, follow our guide to install a Debian package on it.

6 Comments

  1. Incredible! I successfully fired up Tracktion Waveform 11 on Solus 4.1 as I’m writing this. Thanks!

    • It’s possible to do this for a normal use case. On Solus, I’ve decompiled and used several Deb files on it. Also, Arch does this automatically with the AUR.

      Essentially, if you want a Debian package bad enough, follow this method and it will likely work.

  2. Did I miss something here? How do you ship and install such a restructured DEB? Do you tar.gz it up and install it with configure/make/make install?

    • Debian packages are really just AR archives with data inside. Using the commands, you can deconstruct just about any of them. Not really restricted.

  3. Is it possible to install Debian within my current Mac OS X?
    pgopalak@outlook.com