How to add PPA repositories to Debian and distributions based on it

One of the great advantages that Ubuntu has over other distributions is the large number of applications available for this distribution and the ease of installing and keeping them updated through PPA repositories through Launchpad.

Unfortunately the command

add-apt-repository

It is only available for Ubuntu, so adding these repositories is not so easy when you want to add it in a distribution like Debian or based on this you can generally make use of the .deb packages created for Ubuntu.

This is not to say that we cannot make use of these repositories in Debian, since Debian also provides a way to add custom repositories, and then we are going to learn how to do it.

First of all we must understand how repositories are managed in Debian. Which are housed in the file

/etc/apt/sources.list

like all Debian-based distributions, including Ubuntu, and has the following format:

deb http://site.example.com/debian distribution component1 component2 component3 deb-src http://site.example.com/debian distribution component1 component2 component3

The first word in each line (

deb

,

deb-src

) means the type of file found in the repository. In the case of

deb

, it means that the file available in the repository is a binary type installable file, packaged as

.deb

for Debian or distributions based on it. And in the case of

deb-src

, it means that the repository contains the source code of the application.

The distribution may well be the name of the distribution (lenny, etch, squeeze, sid) or the type of package (stable, oldstable, test, unstable).

The components already depend on the repository distributor, for example in the case that we are going to use as an example, these are main, multiverse, restricted and universe.

Now that we know how repositories work in Debian, let's learn how we can add a PPA repository in Debian or distributions based on it.

The first thing to do is find the PPA repository page in Launchpad. We can do this generally by typing in a search engine like Google the name of the PPA repository.

In this manual, we will use the PPA provided by the stable version of ubuntu tweak, ppa: tualatrix / ppa.
In case of not finding the link to the repository page in the search engine, we can directly enter launchpad.net and in the search engine write the name of the PPA repository.

Launchpad Search Box

Following this, we search among the results for the repository page that interests us, finally reaching the site we are looking for, where we will find all the information we need to be able to correctly add the repository in Debian.

Launchpad search results

On the PPA repository page we can find a link in green that says "Technical details about this PPA", we click on this link and we will find the technical information about the repository in question, this information is precisely the addresses

deb

y

deb-src

that we need to add inside the file

/etc/apt/sources.list

which controls the repositories on Debian.

Launchpad GPG Key

Additionally, we can see a drop-down menu with the list of distributions supported by this application. In the best of cases, you will find the latest version of the application for all distributions, but in some cases, each distribution has a different version of the package, being generally older in older distributions. (note that this menu automatically changes the parameter distribution in the repository to make it easier for you to include it in the file

/etc/apt/sources.list

)

Launchpad distribution version

In these technical details we can also find the number of the public key that we will use to digitally sign the repository. This helps us so that the system verifies the validity and security of the repository that we are using.

After knowing all this very important information, we come to the part that we all expected, first of all, we must open the /etc/apt/sources.list file to add the new repository. We can do this by executing the following line in the terminal as root:

gedit /etc/apt/sources.list

With the file open as root, we go to the end of the document and add the repositories to ubuntu tweak (You can add a comment to be more clear about where the repository comes from).

# Ubuntu-Tweak repository by Tualatrix Chou deb http://ppa.launchpad.net/tualatrix/ppa/ubuntu maverick main deb-src http://ppa.launchpad.net/tualatrix/ppa/ubuntu maverick main

With the repository entered in the file

/etc/apt/sources.list

, we can save and close the document.

At this point we already have the repository in the list of Debian repositories, but we may have problems updating this list because Debian may consider the repository unsafe and not download the list of packages it contains.

To avoid this, we will install the public key of the repository by executing the following command in the terminal where we will include the number indicated as the public key in the previous image (0624A220).

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0624A220

If everything goes well, we will see a text like the following in our terminal:

Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg - keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv-keys 0624A220 gpg: requesting key 0624A220 from hkp server keyserver.ubuntu.com gpg : code 0624A220: «Launchpad PPA for TualatriX» unchanged gpg: Total amount processed: 1 gpg: unchanged: 1

If this was the result, we can now calmly update the list of repositories and install the application with the following command:

aptitude update && aptitude install ubuntu-tweak

Final notes:

  • Please note that not all applications of Ubuntu they will work correctly on Debian or the distributions based on it.
  • You must carefully choose the version to use in the packages, since these can lead to the breaking of some dependencies especially in distributions like Debian stable, which does not always provide the latest versions of the packages.