How to manually add a PPA repository to minimal Ubuntu Linux

The Personal Package Archives make it easy to install new software because they are software repositories specifically designed for each version of Ubuntu. Using PPA is one of the easiest way to install software on a Ubuntu distribution and adding a PPA is quite simple.

Gerbera Media Server - Official PPA repository
Gerbera Media Server – Official PPA repository


Usually, you can add a PPA through the add-apt-repository command.


On GUI systems, you have also several different ways to add PPA or third-party repositories, to get more information about, you can check the What are Repositories? page on the Ubuntu Wiki.


As an example, I was looking to install a Gerbera Media Server on an LXC container. I have checked the official instructions here and I was trying to add the Gerbera PPA repository to my system:

$ sudo add-apt-repository ppa:stephenczetty/gerbera-updates
$ sudo apt-get update
$ sudo apt install gerbera

But, I got this:

sudo: add-apt-repository: command not found

Unfortunately, the add-apt-repository tool is usually not installed by default on minimal distributions, containers and docker images. So, we should try to add the PPA repository in a manual way.

I went to the Gerbera PPA page (https://launchpad.net/~stephenczetty/+archive/ubuntu/gerbera-updates) and clicked on the Technical details about this PPA hyperlink.

As you can see, the PPA can be added to your system manually by copying the lines below and adding them to your system’s software sources.

deb http://ppa.launchpad.net/stephenczetty/gerbera-updates/ubuntu bionic main
deb-src http://ppa.launchpad.net/stephenczetty/gerbera-updates/ubuntu bionic main

So to add these entries to the sources.list file, edit it and add the line above at the bottom of the document:

$ sudo vi /etc/apt/sources.list

Then to import the GPG key for that PPA:

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 709DDA6B70F2591B7CE7DAE58E33196C828C83D0

You can find the key under the Fingerprint entry in the Technical details about the PPA.

With the GPG key successfully installed, we can update the package list using the command:

$ sudo apt update

And, in the end, install the latest Gerbera Media Server with this command:

$ sudo apt install gerbera