Ubuntu Linux Remove/Delete PPAs apt-get command

ver time I have added way too many PPAs using the add-apt-repository command on Ubuntu Linux 16.04/18.04 LTS server for testing purpose. How can I delete or remove those PPAs? Is there a command to list all PPAs?
::__IHACKLOG_REMOTE_IMAGE_AUTODOWN_BLOCK__::2
Yes, you can delete or remove a PPA. You must have root privileges to achieve this task.

What is a PPA?

A PPA is an acronym for Personal Package Archive. It is nothing but pre-built binary software repository for apt packages. The author uploads source code and packages are built online using Launchpad.

How do I add a PPA and install a package?

The syntax is:
sudo add-apt-repository ppa:name/her
sudo apt update
sudo apt install package

For example, install a simple animated GIF screen recorder called peek using PPA:
$ sudo add-apt-repository ppa:peek-developers/stable
$ sudo apt update
$ sudo apt install peek

How to list all installed PPAs

Type the following command:
$ grep ^ /etc/apt/sources.list.d/*
Sample outputs:

Fig.01: Ubuntu Linux list all installed PPAs command

How To: Ubuntu Linux Remove/Delete PPAs

The syntax is:
sudo add-apt-repository --remove ppa:name/here
To remove PPA named ppa:gluster/glusterfs-3.9. However, before removing PPA delete all packages installed from the same PPA using apt-get command/apt command:
$ sudo apt-get --purge remove glusterfs-server
$ sudo apt-get --purge autoremove

Now delete PPA:
$ sudo add-apt-repository --remove ppa:gluster/glusterfs-3.9
Sample outputs:

 This archive is EOL. Please use a supported version.
 More info: https://launchpad.net/~gluster/+archive/ubuntu/glusterfs-3.9
Press [ENTER] to continue or ctrl-c to cancel removing it

Finally update your repo:
$ sudo apt-get update
Sample outputs:

Hit:1 http://ppa.launchpad.net/saiarcot895/myppa/ubuntu xenial InRelease
Hit:2 http://download.nus.edu.sg/mirror/mariadb/repo/10.1/ubuntu xenial InRelease         
Get:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]                     
Hit:4 http://mirror.lstn.net/mariadb/repo/10.1/ubuntu xenial InRelease                                    
Hit:5 http://in.archive.ubuntu.com/ubuntu xenial InRelease              
Hit:6 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease
Get:7 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Fetched 204 kB in 1s (185 kB/s)    
Reading package lists... Done

Say hello to ppa-purge tool

The ppa-purge tool is nothing but a bash shell script capable of downgrading all packages in a given PPA back to the original Ubuntu versions. It disables a PPA. First install ppa-purge:
$ sudo apt-get install ppa-purge
Sample outputs:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  aptitude
The following NEW packages will be installed:
  ppa-purge
0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
Need to get 6,312 B of archives.
After this operation, 24.6 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 ppa-purge all 0.2.8+bzr63 [6,312 B]
Fetched 6,312 B in 0s (24.2 kB/s)
Selecting previously unselected package ppa-purge.
(Reading database ... 92785 files and directories currently installed.)
Preparing to unpack .../ppa-purge_0.2.8+bzr63_all.deb ...
Unpacking ppa-purge (0.2.8+bzr63) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up ppa-purge (0.2.8+bzr63) ...

ppa-purge syntax

The syntax is:
$ sudo ppa-purge ppa:repo-name/dirname
$ sudo ppa-purge ppa:saiarcot895/mypp
Sample outputs:

Fig.02: Delete PPAs using ppa-purge script

To remove https://launchpad.net/~saiarcot895/+archive/ubuntu/myppa you can use following syntax too:
$ sudo ppa-purge -o myppa
$ sudo ppa-purge -o saiarcot895 -p myppa

Where,

	-p [ppaname]		PPA name to be disabled (default: ppa)
	-o [ppaowner]		PPA owner
	-s [host]		Repository server (default: ppa.launchpad.net)
	-d [distribution]	Override the default distribution choice.
	-y 			Pass -y --force-yes to apt-get or -y to aptitude
	-i			Reverse preference of apt-get upon aptitude.
	-h			Display this help text
Updated: June 6, 2018 — 6:43 am

Leave a Reply

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

Pandora'Box © 2015 Frontier Theme