Introduzione

Un repository è la raccolta di pacchetti per un sistema operativo Linux. È possibile creare un repository centrale contenente i pacchetti effettivi. Puoi configurare il sistema per connettersi con il repository principale da dove puoi installare e aggiornare i pacchetti.

Ubuntu e altri sistemi basati su Debian utilizzano APT (Advanced Packages Tool) come gestore di pacchetti. Apt conserva tutti i file di configurazione nella directory /etc/apt.

Questo tutorial ti aiuterà a elencare tutti i repository installati in un sistema basato su Ubuntu o Debian tramite la riga di comando.

Elencare i repository installati in Ubuntu

I riferimenti al repository remoto sono configurati nel file /etc/apt/sources.list e tutti i file nella directory /etc/apt/sources.list.d/.

Utilizzare il seguente comando per elencare tutti i repository configurati sul sistema basato su apt:

sudo grep -rhE ^deb /etc/apt/sources.list* 

Vedrai l'output come di seguito:

deb http://archive.ubuntu.com/ubuntu focal main restricted
deb http://archive.ubuntu.com/ubuntu focal-updates main restricted
deb http://archive.ubuntu.com/ubuntu focal universe
deb http://archive.ubuntu.com/ubuntu focal-updates universe
deb http://archive.ubuntu.com/ubuntu focal multiverse
deb http://archive.ubuntu.com/ubuntu focal-updates multiverse
deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu focal-security main restricted
deb http://security.ubuntu.com/ubuntu focal-security universe
deb http://security.ubuntu.com/ubuntu focal-security multiverse
.....
deb http://ppa.launchpad.net/libreoffice/libreoffice-7-0/ubuntu focal main
deb http://archive.ubuntu.com/ubuntu focal main restricted
deb http://archive.ubuntu.com/ubuntu focal-updates main restricted
deb http://archive.ubuntu.com/ubuntu focal universe
deb http://archive.ubuntu.com/ubuntu focal-updates universe
deb http://archive.ubuntu.com/ubuntu focal multiverse
deb http://archive.ubuntu.com/ubuntu focal-updates multiverse
deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu focal-security main restricted
deb http://security.ubuntu.com/ubuntu focal-security universe
deb http://security.ubuntu.com/ubuntu focal-security multiverse

In alternativa, puoi utilizzare il comando apt-cache per elencare tutti i repository. Questo comando fornirà anche maggiori dettagli sul repository.

Proviamo il comando apt-cache:

sudo apt-cache policy 

Dovresti visualizzare un output simile al seguente:

Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://ppa.launchpad.net/libreoffice/libreoffice-7-0/ubuntu focal/main i386 Packages
     release v=20.04,o=LP-PPA-libreoffice-libreoffice-7-0,a=focal,n=focal,l=LibreOffice 7.0.x,c=main,b=i386
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/libreoffice/libreoffice-7-0/ubuntu focal/main amd64 Packages
     release v=20.04,o=LP-PPA-libreoffice-libreoffice-7-0,a=focal,n=focal,l=LibreOffice 7.0.x,c=main,b=amd64
     origin ppa.launchpad.net
 500 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages
     release v=20.04,o=Ubuntu,a=focal-security,n=focal,l=Ubuntu,c=multiverse,b=amd64
     origin security.ubuntu.com
     
.....

 500 http://archive.ubuntu.com/ubuntu focal-updates/main i386 Packages
     release v=20.04,o=Ubuntu,a=focal-updates,n=focal,l=Ubuntu,c=main,b=i386
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
     release v=20.04,o=Ubuntu,a=focal-updates,n=focal,l=Ubuntu,c=main,b=amd64
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu focal/multiverse i386 Packages
     release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=multiverse,b=i386
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages
     release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=multiverse,b=amd64
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu focal/universe i386 Packages
     release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=universe,b=i386
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages
     release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=universe,b=amd64
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu focal/restricted i386 Packages
     release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=restricted,b=i386
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages
     release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=restricted,b=amd64
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu focal/main i386 Packages
     release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=main,b=i386
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
     release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=main,b=amd64
     origin archive.ubuntu.com

Conclusione

In questo tutorial, hai imparato a visualizzare e trovare tutti i repository configurati su sistemi basati su Ubuntu o Debian.