How to Add or Remove a PPA in Ubuntu 18.04

Reading Time: 5 minutes

What is a PPA?

A PPA (or Personal Package Archive) is a software repository provided by members of the Ubuntu Linux community. Software contained in a PPA can be downloaded and installed via apt, Ubuntu’s defacto package management system.

Typically, PPA’s will contain new or updated software to existing packages that may not be available from the official Ubuntu package repositories. This allows users to have more granular control over when specific software packages are updated on their systems. It is important to be discerning when utilizing PPA’s and to only add a PPA from a trusted source.

The best reason for adding software via a PPA, is the server will get automatic updates to the installed software when updates are run.

Preflight Check

  • These instructions are specifically intended for adding and removing a PPA on Ubuntu 18.04.
  • This tutorial was performed on a Liquid Web Self Managed Ubuntu 18.04 LTS server as the root user. 

Syntax

The command line syntax to add or remove a PPA is as follows.

Add - root@ubuntu:~# apt-add-repository ppa:ppa/name
Remove - root@ubuntu:~# apt-add-repository --remove ppa:ppa/name

Add a PPA

Ubuntu 18.04 comes equipped with Python 3.6 by default. For the purposes of this tutorial, we will want to install Python 3.8. In order to do that, run the following command to add the PPA that contains a Debian package built for Ubuntu:

root@ubuntu:~# add-apt-repository ppa:deadsnakes/ppa -y
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:2 https://dl.yarnpkg.com/debian stable InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Get:4 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:5 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease [15.9 kB]
Hit:6 http://download.virtualbox.org/virtualbox/debian bionic InRelease
Get:7 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:8 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [709 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [932 kB]
Get:10 http://security.ubuntu.com/ubuntu bionic-security/main i386 Packages [466 kB]
Get:11 http://security.ubuntu.com/ubuntu bionic-security/universe i386 Packages [621 kB]
Get:12 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [662 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages [675 kB]
Get:14 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe i386 Packages [1014 kB]
Get:15 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1069 kB]
Get:16 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main i386 Packages [30.7 kB]
Get:17 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main amd64 Packages [30.7 kB]
Get:18 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main Translation-en [7064 B]
Fetched 6484 kB in 2s (4261 kB/s)
Reading package lists... Done
root@ubuntu:~#

As of Ubuntu 18.04, running the add-apt-repository command conveniently includes an apt-update as you can see in the above output. Now that the PPA has been added, Python 3.8 can be installed using the following command. (We are using the -y flag to automatically accept any install prompts.)

root@ubuntu:~# apt install python3.8 -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libpython3.8-minimal libpython3.8-stdlib python3.8-minimal
Suggested packages:
  python3.8-venv python3.8-doc binfmt-support
The following NEW packages will be installed:
  libpython3.8-minimal libpython3.8-stdlib python3.8 python3.8-minimal
0 upgraded, 4 newly installed, 0 to remove and 166 not upgraded.
Need to get 4740 kB of archives.
After this operation, 18.6 MB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main amd64 libpython3.8-minimal amd64 3.8.2-1+bionic1 [751 kB]
Get:2 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main amd64 python3.8-minimal amd64 3.8.2-1+bionic1 [1886 kB]
Get:3 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main amd64 libpython3.8-stdlib amd64 3.8.2-1+bionic1 [1694 kB]
Get:4 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main amd64 python3.8 amd64 3.8.2-1+bionic1 [409 kB]
Fetched 4740 kB in 3s (1425 kB/s)
Selecting previously unselected package libpython3.8-minimal:amd64.
(Reading database ... 150173 files and directories currently installed.)
Preparing to unpack .../libpython3.8-minimal_3.8.2-1+bionic1_amd64.deb ...
Unpacking libpython3.8-minimal:amd64 (3.8.2-1+bionic1) ...
Selecting previously unselected package python3.8-minimal.
Preparing to unpack .../python3.8-minimal_3.8.2-1+bionic1_amd64.deb ...
Unpacking python3.8-minimal (3.8.2-1+bionic1) ...
Selecting previously unselected package libpython3.8-stdlib:amd64.
Preparing to unpack .../libpython3.8-stdlib_3.8.2-1+bionic1_amd64.deb ...
Unpacking libpython3.8-stdlib:amd64 (3.8.2-1+bionic1) ...
Selecting previously unselected package python3.8.
Preparing to unpack .../python3.8_3.8.2-1+bionic1_amd64.deb ...
Unpacking python3.8 (3.8.2-1+bionic1) ...
Setting up libpython3.8-minimal:amd64 (3.8.2-1+bionic1) ...
Setting up python3.8-minimal (3.8.2-1+bionic1) ...
Setting up libpython3.8-stdlib:amd64 (3.8.2-1+bionic1) ...
Setting up python3.8 (3.8.2-1+bionic1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
root@ubuntu:~#

Remove a PPA

Now that Python 3.8 is installed, in order to remove the PPA, we will run the following command.

root@ubuntu:~# add-apt-repository --remove ppa:deadsnakes/ppa -y
root@ubuntu:~#
Note:
The PPA removal method above will only remove the PPA. The packages installed via that PPA will remain installed on the system, and you will no longer receive updates from that PPA. Additionally, if you are removing an application installed via the PPA, make sure to removing the software itself using the ‘apt remove packagename’ command before removing the PPA.

To review what PPA’s are currently enabled on your system, you can run a cat command on the /etc/apt/sources.list file.

root@ubuntu:~# cat /etc/apt/sources.list

#

# deb cdrom:[Ubuntu-Server 18.04 LTS _Bionic Beaver_ - Beta amd64 (20180404)]/ bionic main restricted

# deb cdrom:[Ubuntu-Server 18.04 LTS _Bionic Beaver_ - Beta amd64 (20180404)]/ bionic main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic universe
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://security.ubuntu.com/ubuntu bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
deb http://download.virtualbox.org/virtualbox/debian bionic contrib
# deb-src http://download.virtualbox.org/virtualbox/debian bionic contrib
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse
root@host:~#

PPA’s make it possible to stay on the bleeding edge of various software packages regardless of what is provided in the official Ubuntu package repositories. This option is useful for myriad reasons including continuous development. In order for a project to stay current, it might be necessary to pull down the latest version of some dependency in order to verify that things work as expected.

If you would like to install a new PPA or are having trouble removing a PPA, give us a call at 800.580.4985, or open a chat or ticket with us to speak with one of our knowledgeable Linux systems administrators to assist you today!

Refer a friend and get a $50 hosting credit!