Come configurare Apt sources.list per principianti
Che cos’è /etc/apt/sources.list
Il file sources.list elenca i repository (sorgenti) da cui APT scarica pacchetti. Ogni riga ha la forma: deb
Strumenti consigliati
- Source-O-Matic: http://www.ubuntu-nl.org/source-o-matic/ — utile per generare automaticamente un sources.list adatto alla tua versione di Ubuntu/Debian.
- Interfaccia grafica: “Software e aggiornamenti” (software-properties-gtk) su sistemi desktop.
Esempio di sources.list (copia di riferimento)
| # deb cdrom:[Ubuntu 7.10 _Gutsy Gibbon_ - Release i386 (20071016)]/ gutsy main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. # Line commented out by installer because it failed to verify: # deb http://ie.archive.ubuntu.com/ubuntu/ gutsy main restricted # Line commented out by installer because it failed to verify: # deb-src http://ie.archive.ubuntu.com/ubuntu/ gutsy main restricted ## Major bug fix updates produced after the final release of the ## distribution. # Line commented out by installer because it failed to verify: # deb http://ie.archive.ubuntu.com/ubuntu/ gutsy-updates main restricted # Line commented out by installer because it failed to verify: # deb-src http://ie.archive.ubuntu.com/ubuntu/ gutsy-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## universe WILL NOT receive any review or updates from the Ubuntu security ## team. # Line commented out by installer because it failed to verify: # deb http://ie.archive.ubuntu.com/ubuntu/ gutsy universe # Line commented out by installer because it failed to verify: # deb-src http://ie.archive.ubuntu.com/ubuntu/ gutsy universe # Line commented out by installer because it failed to verify: # deb http://ie.archive.ubuntu.com/ubuntu/ gutsy-updates universe # Line commented out by installer because it failed to verify: # deb-src http://ie.archive.ubuntu.com/ubuntu/ gutsy-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. # Line commented out by installer because it failed to verify: # deb http://ie.archive.ubuntu.com/ubuntu/ gutsy multiverse # Line commented out by installer because it failed to verify: # deb-src http://ie.archive.ubuntu.com/ubuntu/ gutsy multiverse # Line commented out by installer because it failed to verify: # deb http://ie.archive.ubuntu.com/ubuntu/ gutsy-updates multiverse # Line commented out by installer because it failed to verify: # deb-src http://ie.archive.ubuntu.com/ubuntu/ gutsy-updates multiverse ## Uncomment the following two lines to add software from the 'backports' ## repository. ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. # deb http://ie.archive.ubuntu.com/ubuntu/ gutsy-backports main restricted universe multiverse # deb-src http://ie.archive.ubuntu.com/ubuntu/ gutsy-backports main restricted universe multiverse ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. This software is not part of Ubuntu, but is ## offered by Canonical and the respective vendors as a service to Ubuntu ## users. deb http://archive.canonical.com/ubuntu hardy partner deb-src http://archive.canonical.com/ubuntu hardy partner # Line commented out by installer because it failed to verify: # deb http://security.ubuntu.com/ubuntu gutsy-security main restricted # Line commented out by installer because it failed to verify: # deb-src http://security.ubuntu.com/ubuntu gutsy-security main restricted # Line commented out by installer because it failed to verify: # deb http://security.ubuntu.com/ubuntu gutsy-security universe # Line commented out by installer because it failed to verify: # deb-src http://security.ubuntu.com/ubuntu gutsy-security universe # Line commented out by installer because it failed to verify: # deb http://security.ubuntu.com/ubuntu gutsy-security multiverse # Line commented out by installer because it failed to verify: deb http://archive.ubuntu.com/ubuntu/ hardy main universe restricted multiverse deb http://archive.ubuntu.com/ubuntu/ hardy-updates universe main restricted multiverse deb http://security.ubuntu.com/ubuntu/ hardy-security universe main restricted multiverse # deb-src http://security.ubuntu.com/ubuntu gutsy-security multiverse # deb http://download.tuxfamily.org/syzygy42 gutsy avant-window-navigator # deb-src http://download.tuxfamily.org/syzygy42 gutsy avant-window-navigator # deb http://archive.ubuntustudio.org/ubuntustudio edgy main
|
All you have to do is go there, fill out three boxes and a new sources.list will be created for you. Here is how to use it.
Copy the new sources.list to your clipboard.
Back up your current sources.list, make a new one and start editing.
sudo mv /etc/apt/sources.list /etc/apt/sources.list.old
sudo touch /etc/apt/sources.list
sudo vim /etc/apt/sources.list
Premi i per entrare nella modalità inserimento in vim.
Esegui clic destro con il mouse: il contenuto degli appunti dovrebbe venire incollato nella finestra di vim.
Premi [ESC] poi digita :wq per salvare ed uscire.
Aggiorna poi i sorgenti:
sudo apt-get update
Se la procedura è andata a buon fine, apt-get update scaricherà gli indici dei pacchetti senza errori. A questo punto dovresti poter installare o aggiornare pacchetti.
Cosa fare se compaiono errori
- Controlla la distribuzione (codename) nelle righe deb: deve corrispondere alla tua release (es. hardy, bionic, focal). Una voce con un nome di release differente può causare 404.
- Verifica la raggiungibilità dell’URL: prova a pingare o aprire l’URI con curl/wget.
- Commenta le righe sospette aggiungendo # all’inizio e riesegui apt-get update.
- Ripristina il backup se necessario: sudo mv /etc/apt/sources.list.old /etc/apt/sources.list
Important: evità di aggiungere repository non ufficiali senza verificare la loro affidabilità. Alcuni repository possono non essere mantenuti o possono contenere software non libero.
Alternative e scenari diversi
- Se usi un desktop GNOME/KDE, apri “Software e aggiornamenti” e gestisci i repository con l’interfaccia grafica.
- Se lavori via SSH da Windows e non puoi incollare facilmente, trasferisci il file con scp o WinSCP.
- Per ripristini rapidi su più macchine, distribuisci il file con Ansible/rsync.
Controlli e criteri di successo
- apt-get update non restituisce errori (es. 404, 403, GPG errors).
- apt-get install
funziona correttamente. - Il file /etc/apt/sources.list è leggibile dall’utente root e non contiene linee duplicate conflittuali.
Procedura di rollback (rapida)
- Se hai ancora il backup: sudo mv /etc/apt/sources.list.old /etc/apt/sources.list
- Esegui sudo apt-get update per verificare lo stato attuale.
Checklist per ruolo
- Principiante:
- Fai un backup del file sources.list.
- Genera il file con un tool online o copia un esempio funzionante.
- Incolla, salva, esegui apt-get update.
- Amministratore di sistema:
- Verifica codename e componenti.
- Controlla GPG keys per repository esterni.
- Automatizza la distribuzione e il controllo di integrità.
Glossario (1 riga ciascuno)
- sources.list: file che elenca i repository APT.
- repository: archivio remoto di pacchetti .deb.
- componente: una sezione del repository (main, universe, restricted, multiverse).
- apt-get update: comando che aggiorna gli indici dei pacchetti.
Riepilogo
Se hai rotto il tuo sources.list, non disperare: genera un nuovo file, fai il backup del vecchio, incolla il nuovo e esegui sudo apt-get update. Verifica sempre codename, URL e firma GPG per evitare errori.
Note:
- Alcuni esempi mostrano vecchie release (gutsy, hardy): assicurati di usare i nomi corretti per la tua macchina.
- Evita repository non ufficiali se non sei sicuro della fonte.
Materiali simili

Errore caa70004 Teams: risoluzione su Windows

Disattivare digitazione gestuale su Android

gdi32full.dll mancante: come riparare Windows 10

Immagine profilo personalizzata su Netflix

Convertire .img in file flashabili per Odin
