How to Disable a Particular PPA in Ubuntu

PPA (Personal Package Archive) is used for distributing software in Ubuntu without going through the whole process of making software available in official Ubuntu repositories.

Usually, PPA’s are used for making available non-standard software, which are unavailable in Ubuntu repositories, for installation via ‘apt‘ utility. A PPA has a corresponding custom repository to it, and with every ‘apt update‘ run, the list of packages is fetched from it.

The user might want to enable or disable an already added PPA in Ubuntu based on the availability and well-functioning of the repository, without deleting the PPA entry itself.

Today, we will see how to disable a particular PPA in Ubuntu.

Listing Ubuntu Repositories

The list of repositories, both standard and PPA, is maintained in configuration files called Source files, in Ubuntu. When you run ‘sudo apt update‘ you can see the URLs to the repositories in the log.

$ sudo update
View Enabled PPA Repositories
View Enabled PPA Repositories

Here, the URLs with ‘ppa.launchpad.net‘ are the PPA repositories.

The configuration files are available in the directory ‘/etc/apt/‘.

$ cd /etc/apt
$ ls
Ubuntu Repository Configuration Files
Ubuntu Repository Configuration Files

Here, the file ‘sources.list‘ contains standard Ubuntu repositories, while PPA source files are available in folder ‘sources.list.d‘.

$ cd sources.list.d
$ ls 
Ubuntu PPA Configuration Files
Ubuntu PPA Configuration Files

Disable a PPA in Ubuntu

There is one source file in this folder; which defines a repository for unofficial PPA for PHP installation. Let’s open this file.

$ sudo vim ondrej-ubuntu-php-groovy.list

To disable the repository, simply comment on the lines by adding a hash (#) character at the beginning of the lines.

Disable PPA in Ubuntu
Disable PPA in Ubuntu

Save and exit the file.

Now run the apt update again to verify if the PPA source is not being read.

$ sudo apt update
Confirm PPA Repositories
Confirm PPA Repositories

The apt update is now only considering the standard repositories, and thus, we have disabled the PPA for unofficial PHP installation.

To enable this PPA again, simply uncomment the lines, by removing the hash (#) characters from both the lines.

Conclusion

In this article, we have seen how to disable a PPA in Ubuntu. PPA’s do not follow the same set of security procedures as standard Ubuntu packages, and hence are less secure. Users should take precautions while adding a PPA repository on their Ubuntu machine.

If you have any questions or feedback, let us know in the comments below!

Got something to say? Join the discussion.