Getting to know PPA in Ubuntu

Aniruddha Chatterjee
4 min readAug 28, 2020

--

When I started development in college, I was a loyal Windows user. Overtime long sessions of coding and the Windows updates in between made me rethink my choices. I finally decided to give Ubuntu a spin, and I fell in love with it.

If you are on Ubuntu or any other Linux based distribution like Linux Mint or Zorin OS, you must have seen something like

sudo add-apt-repository ppa:notepadqq-team/notepadqq
sudo apt-get update
sudo apt-get install notepadqq -y

And your software gets magically installed. While this is a great way to install new software, let us learn the magic behind this trick that makes it possible.

Prerequisites

It will be really helpful if you are having a Debian based Linus OS on hand. I will be using Ubuntu 20.04.01 LTS Focal Fossa for this tutorial. However, any other distribution based on Ubuntu/Debian should be fine as well.

Repositories

Before we dive into PPA, let us learn about something called “repositories”. A repository is a collection of files which include various information and some details. These repositories are what our system uses to install applications and drivers. Ubuntu maintain 4 official repository sets:

  • Main
  • Universe
  • Restricted
  • Multiverse

We will not do into their details. Every Ubuntu version has their own sets of these four. You can view a list of the repositories maintained for Ubuntu 20.4 Focal Fossa from the “Further Ahead” section.

How will your system know about these repositories you ask? Well if you navigate to “/etc/apt”, you will find a file called “sources.list”. This file contains all the links to the repositories maintained by Ubuntu.

A sample sources.list file

When you install something using the APT tool, it will look in this file for the information to install the said package. If no such information matches your requested package name, you will get an “Unable to locate package” error.

Now what happens is, since these repositories are maintained by Ubuntu, there is a considerable time gap between updates pushed by developers and the updated code in the repositories (in other words, updates are super slow).

Hello PPA!

PPA — Personal Package Archive

Ubuntu provides a platform called Launchpad which allows developers to create and maintain their own repositories. Each repository here is called a “Personal Package Archive” or PPA.

Creating and maintaining your own PPA means you have full control over the development life cycle of your software. Your updates need not go through Ubuntu so they are considerably fast.

But how does a system know about these PPA? Well it does not. So we need to add the PPA ourselves. We use the command,

sudo add-apt-repository ppa:<path>

This command will make two files in “/etc/apt/sources.list.d”. One file will have the suffix “.list” and the other one “.save”. The latter is a backup in case anything goes wrong.

A sample showing the two files for each PPA added — one .list and one .save

So now that our PPA path is added, we will need to update our sources so that our APT tool can work with our PPA. The command is

sudo apt-get update

And the last thing to so is to install our said package name. We do that by

sudo apt-get install <package-name>

And our package will be installed. Magic, is it not?

Let us install a package via PPA so that out concepts can become clearer still.

Example — Installing GIMP

GIMP or GNU Image Manipulator is a very famous application used for editing images.

We will install the GIMP via the PPA from https://launchpad.net/~otto-kesselgulasch/+archive/ubuntu/gimp

Step 1: Adding the PPA to our system. We shall run the following command to add the PPA to our “sources.list.d”

sudo add-apt-repository ppa:otto-kesselgulasch/gimp

This command creates the required “.list” file. One thing to note here is we do not need the absolute path of the PPA. We just give an abstract PPA path and Ubuntu knows where to find the required files (cool, eh?).

We can see our PPA is added as a list in “sources.list.d”

Step 2: Updating our sources. We need to update our sources so that the APT tool will know what do we mean by “gimp”.

sudo apt-get update

This will ensure that APT tool finds our PPA when we ask it about gimp. It downloads the required package data from the servers.

Step 3: Installing GIMP. The final step to install GIMP. And that will be

sudo apt-get install gimp

And if no disaster occurs, you can enjoy using GIMP!

Conclusion

We learnt about repositories and PPA, how they work and how they are used by the APT tool. Repositories and PPA are used by a lot of applications and drivers.

We also have other ways to install software like .deb packages, flatpacks, AppImage and so on. I might cover these in a later post. For now, enjoy installing apps with your new found knowledge of PPA! Stay safe, stay tuned. Peace out.

Further Ahead

Feel free to use these resources to play around.

--

--

Aniruddha Chatterjee

Nocturnal animal that thrives on caffeine and loves software development.