Open In App

Using PPA in Linux

Last Updated : 02 Jun, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

Personal Package Archives (PPA) is a unique software repository intended for non-standard software/updates. The PPA allows application developers and Linux users to create their own repositories to distribute software. It allows us to upload Ubuntu source packages to be built and published as an apt repository by Launchpad. With PPA, we can easily get newer software versions or software that are not available via the official Ubuntu repositories.

Repositories in Linux

The Linux programs are available to meet the needs of users. Many of these programs are stored in software archives commonly referred to as repositories. A repository is a collection of files that has information about various software, their versions, and some other details like the checksum. It makes it easy to install new software, while also providing a high level of security since the software is thoroughly tested and built specifically for each version of Linux.

Types of Repositories in Linux:

  • Main – Canonical-supported free and open-source software.
  • Universe – Community-maintained free and open-source software.
  • Restricted – Proprietary drivers for devices.
  • Multiverse – Software restricted by copyright or legal issues.

On Ubuntu and all other Debian-based distributions, the apt software repositories are defined in the /etc/apt/sources.list file or in separate files under the /etc/apt/sources.list.d/ directory. With the help of this file, the system tracks the location of the program installed so that it can update it. The system uses the APT tool to check against the repo and stores the information about the software and its version in a cache.

APT Repositories listed in sources.list file

 

As you can see above, sources.list file has uncommented URL links that the system uses to get that package from where the actual software is stored.

Need for PPA in Linux :

PPA’s are the only way to get your software updated in between two Linux-Distro releases. In other words, if a new version of your favorite software comes out then you may not have to wait until the next version of the distro comes out because the latest versions are not available in the repository so here we can use PPA to install the latest version of any software from the repository. This makes it easy for Linux users to install packages in the same way they install standard packages During the beta testing of software, a developer may want some end-users to test their upcoming release even if a stable version of the software is available in the official repositories, they can use PPA.

Using PPA in Debian based Ubuntu(20.04 LTS):

Ubuntu provides a platform called Launchpad that enables us to create our own repositories. All we need to do is to create our own source package, upload it and the Launchpad will build binaries and then host them in our own apt repository. This makes it easy for Ubuntu users to install packages in the same way they install standard Ubuntu packages, and one of the advantages is that they will automatically get updated once we make them available. 

We can add the PPA repository to our sources. list file and when we update our system, it would know about the availability of this new software and we can install it using the standard sudo apt install command. 

sudo add-apt-repository ppa:shutter/ppa
sudo apt-get update 
sudo apt-get install shutter

It is important to use the command sudo apt update to update our system or else our system will not know when a new package is available. If we try to install software without mentioning its PPA in sources.list file then it will show the package has no installation candidate.

No installation candidate

 

We can also add PPA to our sources.list file using the below commands :

deb https://ppa.launchpadcontent.net/shutter/ppa/ubuntu focal main 

deb-src https://ppa.launchpadcontent.net/shutter/ppa/ubuntu focal main 

 The above command is similar to the add-apt-repository command but we need the exact repository URL and operating system version.

In this example for demonstration, we are using the PPA of a screenshot tool named Shutter. To know the PPA for the latest version of any software we go to the website launchpad.net and type the software name we need in the search dialogue box for example shutter screenshot. Launchpad is a software collaboration platform for building and hosting ubuntu packages.

Launchpad.net

 

When we use PPA, it doesn’t change our original sources.list file instead it creates two files in /etc/apt/sources.list.d directory, a list and a backup file with suffix ‘.save’. The backup file with the .save extension ensures that adding PPAs will not change the original sources.list. It also helps in removing the PPA. Whereas the files with the suffix ‘.list’ have the command that adds the information about the repository.

PPA inside sources.list.d

 

Adding PPA via terminal:

To add a PPA from the terminal, we use the syntax as shown below:

sudo add-apt-repository ppa:shutter/ppa

Here we are adding the PPA of a screenshot tool named Shutter. The command above will create a file under /etc/apt/sources.list.d.

Adding PPA via Terminal

 

Backup of Repository Sources:

Ubuntu maintains a list of repositories in the “/etc/apt/sources.list” file. Before doing anything or manually editing this text file, you should take a backup of sources by running the command below :

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

The backup file of sources.list

 

Removing PPA via terminal : 

To remove the PPA using terminal, we use the syntax as shown below:

sudo add-apt-repository –remove ppa:shutter/ppa

This command is similar to adding a PPA. We use the –remove option in the command following the exact name of the PPA. It will delete the PPA from the system.

Removing PPA via terminal

 

Problem with DEB packages:

If we want to install software using a DEB package, there is no guarantee that the installed software will be updated to a newer version when you run sudo apt update && sudo apt upgrade command. It’s because the apt upgrade method depends on the sources.list file. If there is no entry for software, it doesn’t get the update via the standard apt installation. But if the developers add an entry to the sources.list and then it gets updated automatically like regular software.

Security concerns with PPA’s:

There is always a risk that these third-party repositories may contain malicious packages having malware or adware which can be distributed through PPAs. Therefore we should always be careful while adding any random repository, as packages as these PPAs may or may not have been verified by Linux developers. 



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads