How To Use A Launchpad PPA (Add, Remove, Purge, Disable) In Ubuntu

11:12 PM

Here we are, talking about installing stuff from PPAs, but we've never posted more about the PPAs themselves. So here's a short guide on how to use a Launchpad PPA in Ubuntu.

Launchpad PPAs ("Personal Package Archive") are repositories hosted on Launchpad which you can use to install (or upgrade) packages that are not available in the official Ubuntu repositories.

The packages are built on the Launchpad servers (not on the users' computers), for the specified Ubuntu version(s). Because the packages are built against a certain Ubuntu version, it's not recommended to use them in Debian for instance (they might not be compatible and can cause conflicts).


How to add a PPA


how to add a PPA

A PPA can be added either from the command line or using a GUI.

Add a PPA from the command line: I guess you already know that you can add a PPA using the "add-apt-repository" command, but in case you're new to PPAs, here's how to do it:
sudo add-apt-repository ppa:someppa/ppa

Example:
sudo add-apt-repository ppa:webupd8team/gnome3

After adding a PPA, you'll also need to update your software sources, so the packages available in this newly added PPA can be "seen" by your computer. This can be done using the following command:
sudo apt-get update


how to add a PPA using a gui

Add a PPA using a GUI (Ubuntu Software Center / Software Sources): A PPA can be added using a GUI too. To do this, open "Software Sources" - in recent Ubuntu versions, this can be done by going to Ubuntu Software Center > Edit > Software Sources. Then, on the "Other Software" tab, click "Add" and enter the PPA under the same "ppa:someppa/ppa" form. 

The Launchpad blog has posted a video on how to do this, a while back:




As you can see in the video above, adding a PPA this way also updates the software sources so you don't have to run "sudo apt-get update".


How to remove (delete) a PPA


To remove a PPA means to only delete the repository from your system, without removing any packages you may have installed / upgraded from that PPA. 


how to remove a ppa ubuntu

Here is how to remove a PPA using the command line:
sudo add-apt-repository --remove ppa:someppa/ppa

Example:
sudo add-apt-repository --remove ppa:webupd8team/gnome3


how to remove a ppa ubuntu gui

Remove a PPA using a GUI: A PPA can also be removed by opening Software Sources (Ubuntu Software Center > Edit > Software Sources), then going to the "Other Software" tab, selecting the PPA you want to remove and then clicking the "Remove" button.

Each PPA should have two lines here, one for the compiled packages and one for the source, so remove both lines.

There's also a third method of removing a PPA: by deleting the .list file from /etc/apt/sources.list.d (see below).


The PPA .list file



When you add a PPA, a new .list file is created under /etc/apt/sources.list.d/. The files are named based on the PPA name and your Ubuntu version, like this: "someppa-ppa-oneiric.list".

Example: when adding the ppa:webupd8team/gnome3 PPA in Ubuntu Oneiric, the list file should look like this "webupd8team-gnome3-oneiric.list".

Here's how a .list file content looks like:
deb http://ppa.launchpad.net/webupd8team/gnome3/ubuntu oneiric main
deb-src http://ppa.launchpad.net/webupd8team/gnome3/ubuntu oneiric main

Like I've explained above, each PPA should have two lines here, one for the compiled packages (first) and one for the source code (second).

It's good to know where these .list files are located in case you add a PPA and want to edit it: either because of a bug that doesn't add it correctly (I've seen it quite often), or because you want to modify the Ubuntu version (in my example above, you would need to replace "oneiric" with some other Ubuntu version) in case you move the PPAs to another computer running a different Ubuntu version, manually enable/disable the PPAs (adding "#" in front of a PPA line disables it) and so on. Some of thse operations can also be performed using Software Sources (already covered in this post).



How to disable a PPA


Disabling a PPA means you won't receive any updates from that PPA anymore, but it does not remove any installed / upgraded packages. The advantage of disabling a PPA instead of removing it is that you can easily re-enable it.

To disable a PPA, open Software Sources (Ubuntu Software Center > Edit > Software Sources) and uncheck the box next to the PPA you want to disable. Remember to disable both lines: the main and the source code line.

In the same way you can also re-enable a PPA.



How to purge a PPA


Purging a PPA means not only to disable the PPA, but also to downgrade any packages you've upgraded from that PPA, to the version available in the official Ubuntu repositories.


how to purge a PPA Ubuntu

Here's an example: let's say you've added the Unity Staging PPA in Ubuntu 12.04 and upgraded to the latest Unity from trunk. Something goes wrong and you want to go back to the Unity version available in the official Ubuntu 12.04 repositories - in this case, you can use PPA Purge to purge the Unity Staging PPA and all the packages upgraded from this PPA should return to the version available in the official Ubuntu 12.04 repositories.

To be able to purge a PPA, you need to install "ppa-purge":
sudo apt-get install ppa-purge

To purge a PPA, you must use the following command:
sudo ppa-purge ppa:someppa/ppa

For example, to purge the Unity Staging PPA, you would use:
sudo ppa-purge ppa:unity-team/staging

If the 'ppa-purge' command fails for some reason, you can't run 'ppa-purge' again unless you re-enable the PPA - see how to re-enable it above (under "How to disable a PPA").

Purging a PPA can be a bit tricky sometimes, because if a package installed from a PPA doesn't exist in the official Ubuntu repositories, it can't be downgraded and PPA Purge won't remove it either, so you'll have to remove it manually. But the PPA Purge purpose is to restore the original packages from the Ubuntu repositories in case something goes wrong when upgrading some packages from a PPA, and for this purpose, PPA Purge usually works great.


Also see: Y PPA Manager, a tool you can use to easily add, remove, purge, search for PPAs and more.

0 comments:

Post a Comment