A Guide to Using PPA Repositiories in Ubuntu

29/12/2020
One of the benefits of using Ubuntu is the wide availability of a range of third party repositories. These repositories or PPAs are really useful to install packages not available in official Ubuntu repositories or to upgrade existing packages to newer versions.

What is a PPA?

A “Personal Package Archive” or a PPA is an application repository that can be used to upgrade and install packages from unofficial sources.

Difference Between PPAs and Other Repositories

Deb packages (sort of Ubuntu’s equivalent to Windows’ .exe installers) can be served through any repository that adheres to Debian’s rules and guidelines for creating and maintaining repositories. For instance, openSUSE build service often provides repositories that can be used to install and upgrade packages in Ubuntu. On the other hand, a PPA is hosted on Canonical’s servers and is served through its Launchpad platform. Users hosting PPAs on Launchpad don’t require their own server to distribute packages, while other repositories need a server to do the same. In this article, terms like PPA and repository will be used interchangeably.

PPA / Repository Formats

Below are some examples of PPA / repository patterns:

  • deb http://myserver/path/to/repo stable myrepo
  • deb-src http://myserver/path/to/repo stable myrepo
  • http://myserver/path/to/repo myrepo
  • https://packages.medibuntu.org free non-free
  • http://extras.ubuntu.com/ubuntu
  • ppa:user/repository
  • ppa:user/distro/repository
  • multiverse

Security Concerns with PPAs

Even though we have not heard of malware or adware distributed through PPAs so far, there is always a risk that these third party repositories may contain malicious packages. You should always be careful when adding any random repository, as packages in these PPAs may not have been verified by Ubuntu developers. Only add a PPA if you trust its source.

Taking a Backup of Repository Sources

Ubuntu maintains a list of repositories in “/etc/apt/sources.list” file. Before doing anything mission critical 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

Adding a PPA Using Command Line

To add a PPA, run the commands below while replacing “ppa:name” with your desired PPA address:

$ sudo add-apt-repository ppa:name
$ sudo apt update

For example, command for adding Geany text editor PPA would be:

$ sudo add-apt-repository ppa:geany-dev/ppa

If no errors are observed, run the command below to upgrade existing packages:

$ sudo apt upgrade

If you added a PPA to install a new package, run command below while replacing “package-name” with your desired package name:

$ sudo apt install package-name

Removing a PPA Using Command Line

To remove a PPA using command line, you have to run the command below in the following format:

$ sudo add-apt-repository –remove ppa:name

For example, Geany text editor PPA added from here can be removed by running the command:

$ sudo add-apt-repository –remove ppa:geany-dev/ppa

Another method to remove a PPA is to manually delete a PPA source file from system. To see all PPA files, run the command below:

ls /etc/apt/sources.list.d

You will see a file list in terminal. Any file ending with “.list” extension can be deleted to remove a PPA from system. To do so, run command in the following format:

$ sudo rm -i /etc/apt/sources.list.d/ppa_filename.list

Refresh system repositories by manually triggering an update.

$ sudo apt update

For example, Geany text editor PPA added from here can be removed by using the command:

$ sudo rm -i /etc/apt/sources.list.d/geany-dev-
ubuntu-ppa-eoan.list

Using PPA-Purge to Remove PPAs

PPA-Purge is a command line utility that removes a PPA source while downgrading packages installed from the specified PPA to stock versions. To install PPA-Purge command line app in Ubuntu, run the following command:

$ sudo apt install ppa-purge

To purge a PPA, run a command in the following format:

$ sudo ppa-purge “ppa:address”

For example, Geany text editor PPA added from here can be purged by running command:

$ sudo ppa-purge ppa:geany-dev/ppa

Graphical Method to Add, Remove and Disable a PPA

In most cases, using “Software & Updates” app can be used to manage PPAs that have been added to system. However due to a bug, this app fails sometimes doing tasks that require root access. To overcome this, you will have to install Synaptic package manager by running the command below:

$ sudo apt install synaptic

Launch “Synaptic Package Manager” from application launcher. Click on “Settings” > “Repositories” and go to “Other Software” tab. Click on “Add..” button at the bottom and then enter a PPA address in the input box. Click on “Add Source” once done.

Click on “Close” button and when prompted to refresh repositories, just click on “Reload” button.

Removing and disabling repositories can be done the same way. Click on the “Remove” button at the bottom to remove a PPA from system. You can disable a PPA by unchecking the checkbox in front of a PPA source address.

Browsing All Repositories Added on Your System

To see all PPA repositories added on your system, launch Synaptic app and click on “Origin” button, as shown in the screenshot below:

Conclusion

PPA repositories are an excellent way to add third party apps to your system as not everything can be maintained and included in official repositories. This has been one of the many reasons of Ubuntu’s rising popularity over the years. However, new distribution agnostic solutions like Snap and Flatpak packages provide granular permissions control and isolated sandboxes, giving them an extra layer of security over typical PPAs.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Ubuntu for Android is Dead

The developer community has always had a thing for open source software. This is precisely why Ubuntu became so famous all...
12/02/2020

Change Swap Size in Ubuntu

In the case of Linux, the swap file is an important part. It’s not a must-have option but having one is crucial for a...
29/12/2020

40 Things to do After Installing Ubuntu

Ubuntu has become very popular operating system not only among programmers and developers but also among normal day-to-day...
29/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn
03/06/2024

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh
03/06/2024

Mua proxy Onet uy tín tại Onet.com.vn
03/06/2024

Thuê mua IPv4 giá rẻ, tốc độ nhanh, uy tín #1
28/05/2024

Thuê địa chỉ IPv4 IPv6 trọn gói ở đâu chất lượng, giá RẺ nhất?
27/05/2024