Whenever you want to install a software package to your Ubuntu system, you first refer to the official Ubuntu repository listed in your system’s sources.list file. If the software is not available there, you can install it through any PPA repository it is available on. PPA repositories are unofficial repositories of those software packages that are made available to users through Launchpad. Launchpad, a platform developed by Canonical, lets developers upload their code on it where .deb packages are made available for users to install the software from.
In this article, we will describe how to use the Ubuntu command line and the graphical user interface in order to:
- List the PPA repositories added to your system
- Add a PPA repository to your system to download software from
- Remove an added PPA repository from your system
We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system.
PPA Repositories Management through the Command Line
If you are like me who prefers using the command line for performing all administrative operations on Linux, here is how you can perform basic repository management on Ubuntu.
You can open the Ubuntu command line, the Terminal, either through the system Dash or the Ctrl+Alt+T shortcut.
List Added PPA Repositories
If you want to list all the repositories available on your Ubuntu system, enter the following command in the Terminal:
$ apt policy
Another method to list all the added PPA repositories is to print the contents of the /etc/apt/sources.list.d directory. This directory contains the list of all repositories available on your system.
Here is how to use the command:
$ ls /etc/apt/sources.list.d
Add a PPA Repository
Only an authorized user can add/remove and configure software and repositories in Ubuntu. Here is the command syntax that you can use as sudo in order to add a PPA to your system:
$ add-apt-repository ppa:ppa_name
And then install the required package from the added repository as sudo as follows:
$ apt install package_name
In Ubuntu 18.04, you do not need to use the apt-get update command after adding a new repository as the system automatically performs this operation. In earlier versions of Ubuntu, you needed to run the following command before installing a package so that you could install the latest available version of a software:
$ sudo apt-get update
Example:
Let us present an example where we will add the Thomas Schiex PPA repository to our system that we will later be using to install Blender, a 3D creation suite.
We will add the PPA through the following command as sudo:
$ sudo add-apt-repository ppa:thomas-schiex/blender
Now that the PPA is added, it is as simple as entering the following command to install the latest Blender application:
$ sudo apt-get install blender
Remove a PPA Repository
If you want to remove an added PPA repository from your system, you can use the following command syntax as sudo:
$ add-apt-repository –remove ppa:ppa_name
The above command only removes the PPA from your system and not the software package you have installed through it.
For example, in order to remove the repository I added in the previous section, I will run the following command in the Terminal:
$ add-apt-repository --remove ppa:thomas-schiex/blender
Purging a Repository
Purging a repository means removing it from your system and also downgrading software packages that you have downloaded through it. There is this utility called PPA Purge that you can use for this purpose.
You can install this utility through the official Ubuntu repositories as follows:
$ sudo apt-get install ppa-purge
You can then use the following command syntax to purge an added repository:
$ ppa-purge ppa:ppa_name
Example:
$ ppa-purge ppa:thomas-schiex/blender
Manually Removing a Repository
As mentioned above, your added repository’s .list files are saved in the /etc/apt/sources.list.d directory. You can manually remove a PPA from this directory by using the rm command as follows:
$ rm /etc/apt/sources.list.d/ppa_list_file
Example:
$ sudo rm /etc/apt/sources.list.d/thomas-schiex-ubuntu-blender-bionic.list
PPA Repositories Management through the UI
A Ubuntu UI utility called Software and Updates helps you in managing both your Ubuntu official and PPA repositories. Here is how you can use it:
List Added PPA Repositories
In order to open the Software and Updates utility, enter relevant keywords in the Dash search as follows, or else you can open it directly from the Applications list.
By default, the Software and Updates utility opens in the Ubuntu Software tab. In order to view the PPA repositories added to your system, select the Other Software tab.
Add a PPA Repository
In order to add a new PPA repository, click on the Add button from the Other Software view. The following dialog will open:
In the APT line field, put the name of the PPA you want to add and then click the Add Source button. The system will then ask you for authentication as only an authorized user can add a repository to Ubuntu. Enter the password for sudo and then click Authenticate.
Your new repository will be added to your system and will appear in the Other Software list of this utility.
Remove a PPA Repository
You can remove an added PPA by first selecting it from the Other Software listing in the Software and Updates utility, and then clicking the Remove button.
Now you are able to manage the PPA repositories to explore much more than is available on the official Ubuntu repositories.