apt get repository

List Add & Remove PPA Repository in Ubuntu & Debian

PPA aka Personal Package Archive are repositories designed to deliver software. Apt package manager makes use of these servers; downloads and installs the software programs they contain.

The Apt package manager stores its repository database in /etc/apt/sources.list file. Also it reads the files in the  /etc/apt/sources.list.d directory to get information for the available third party PPA

There are several Ubuntu PPA: main, multiverse, universe, partner. Also there are third party repositories

Using PPA is a convenient and easy way to distribute software, yet they are to be used with caution. Only add repositories from sources you trust!

In this example I am working on a Ubuntu 19.04 (Disco Dingo) workstation. The first task is to list the all the available repositories with the command apt policy

mycomputer name:~$ apt policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
500 http://dl.google.com/linux/chrome/deb stable/main amd64 Packages
     release v=1.0,o=Google LLC,a=stable,n=stable,l=Google,c=main,b=amd64
     origin dl.google.com
 500 http://de.archive.ubuntu.com/ubuntu disco-security/multiverse i386 Packages
     release v=19.04,o=Ubuntu,a=disco-security,n=disco,l=Ubuntu,c=multiverse,b=i386
     origin de.archive.ubuntu.com
 500 http://de.archive.ubuntu.com/ubuntu disco-security/multiverse amd64 Packages
     release v=19.04,o=Ubuntu,a=disco-security,n=disco,l=Ubuntu,c=multiverse,b=amd64
     origin de.archive.ubuntu.com

If you need to know what is the repository Ubuntu has installed Chrome, for example, modify the command by redirecting the results through a pipe:

apt policy | grep chrome

The command above will show you all the entries containing the string ‘chrome’.

Removing PPA with add-apt-repository

That can be easily done by using the command add-apt-repository. We will need a root privileges in change the APT configuration.

In this example I will remove the current chrome repository from the configuration files.

$ sudo add-apt-repository --remove ppa:dl.google.com/linux/chrome/deb 

Using apt-get-repository to add a repository

Adding a repository with the apt-get-repository command is even easier. The command below will add the chrome repository again:

$ sudo add-apt-repository ppa:dl.google.com/linux/chrome/deb

Leave a Comment

Your email address will not be published. Required fields are marked *