How to: Add or Remove PPA repository from command line on Ubuntu


A Personal Package Archives (PPA) is a Ubuntu way to allow independent developers and contributors to build and distribute any custom packages as a third-party APT repository via Launchpad. If you are a Ubuntu user, chances are that you will add some day a third-party PPA repositories to your Ubuntu system.

Adding a PPA
First you need to install a package that contains the utility called add-apt-repository

sudo apt-get install python-software-properties
sudo apt-get install software-properties-common

Suppose you need to add a third-party PPA repository named “ppa:mozillateam/firefox-next”

sudo add-apt-repository ppa:mozillateam/firefox-next

First is displayed some info about the PPA and you need to press ENTER to continue or CTRL+c to exit.
Your system will fetch the PPA's key. This enables your Ubuntu system to verify that the packages in the PPA have not been interfered with since they were built.

Now you should tell your system to download the latest list of software from each archive it knows about, including the PPA you just added:

sudo apt-get update

You're ready to start installing software from the PPA!

Removing a PPA

If you want to delete a PPA repository alone, run the following command.

sudo add-apt-repository --remove ppa:mozillateam/firefox-next

The above command does not remove any packages installed or upgraded from the PPA itself.

If you want to delete a PPA repository as well as all packages installed/upgraded from the PPA, you can use ppa-purge command.

First install the package ppa-purge

sudo apt-get install ppa-purge

To remove a PPA repository and all its packages from the command line:

sudo ppa-purge ppa:mozillateam/firefox-next

Update the software list to check all is clean

sudo apt-get update

If somehow the above commands to remove the ppa are gone wrong you can always delete manually

cd /etc/apt/sources.list.d
rm -f mozillateam-firefox-next*

Adjust mozillateam-firefox-next* with the ppa name you are dealing with

Reference links:

Leave a Reply

Your email address will not be published. Required fields are marked *