Objective

Install packages from Ubuntu PPAs on Debian.

Distributions

Debian

Requirements

You need a working Debian install with root privileges.

Difficulty

Medium

Conventions

  • # - requires given command to be executed with root privileges either directly as a root user or by use of sudo command
  • $ - given command to be executed as a regular non-privileged user

Introduction

Ubuntu and it's derivatives are easily the most popular Linux distributions in the world. As a result, they enjoy more third party support than most other distributions, including Ubuntu's parent, Debian.

It's often frustrating for Debian users to come across software packaged in the .deb format and made freely available, but not to them. Ubuntu packages don't always work on Debian. Actually, more often than not, there's some kind of problem running or installing them. Plus, Debian isn't really set up to interact with Ubuntu PPAs.

So, what's a Debian user to do? That's something the Debian Project has thought of. There's actually a defined method for downloading source packages from Ubuntu PPAs and rebuilding them for Debian. As an added bonus, it's not really that hard.

Install the Dependencies

Before you start, there are a couple of general build dependencies that you'll need. Of course, you need the general build tools, plus some Debian packaging scripts.
# apt install build-essential devscripts
That's really all! You might need some specific dependencies for the package that you want, but that'll be later.

Add the Source PPA



Ubuntu PPA deb listing

Next, you'll need to find a PPA that you want to use. Most Ubuntu PPAs have a section where you can view the actual deb and deb-src records. On Launchpad, it's under a menu labeled "Technical details about this PPA." You'll need to copy the deb-src record.

Add The PPA To Apt Sources

Open up your text editor of choice as root, and create a .list file under /etc/apt/sources.list.d/ for your new PPA. Select the version of Ubuntu that is the closest match to your version of Debian.
deb-src http://ppa.launchpad.net/commendsarnex/winedri3/ubuntu artful main 

Import The Key



Ubuntu PPA siging key

You've got to import the signing key from the PPA in order for Apt to update your repositories and install. It's usually displayed prominently on the PPA homepage. Copy the key following the /. Then, run the following command using your copied key.

Add The Ubuntu PPA Key To Apt

# apt-key adv --keyserver keys.ubuntu.com --recv-keys THE_KEY
After Apt imports the key, run an update.
# apt update

Build



Build The Debian Packages

You can actually build your new packages as a regular user. Actually, it's better to do it that way. Create a directory where you want to build your packages, then cd into that directory. Once inside that directory, run the following command to build your packages. Substitute the name of the package that you want to build and the version of Ubuntu your PPA is from.
$ apt source -t artful --build packagename


Additional Dependencies Needed To Build

This will take some time, depending on the package. This is the place where you may encounter dependency errors. There are a few ways to solve them. You can manually copy the list provided by the script, and install them. If the package is a variation of an existing Debian package, you can use apt build-dep. Unfortunately, that won't work with your PPA. Apt only allows build-dep from the default repository.

Install With DPKG



Completed Debian Packages

Once you have your packages, you can install them as root using dpkg. It does take wildcards, so as long as there aren't any other Debian packages in your build directory, you can do something like this:
# dpkg -i *.deb
Unless there is some strange unforeseen conflict(There shouldn't be, since you built them), your new packages will install on Debian.

Closing Thoughts

Now, you can use Ubuntu PPAs to build your own Debian packages, and take advantage of much of the software that Ubuntu has to offer. This won't work in every situation, but it will work in most. If the source isn't available, you won't be able to build the packages. You can certainly try installing the existing binaries, but understand that it is a risk to do so.

If you have a package like the version of Wine pictured in this guide, you can build the 32bit packages by using a debootstrap to set up a chroot environment. Then, follow the same procedure as the 64bit ones.