## page was renamed from LorenzoZoffoli/Bozze/Repository/LineaDiComando '''''QUESTA PAGINA È IN FASE DI TRADUZIONE. ORIGINALE: https://help.ubuntu.com/community/Repositories/CommandLine''''' #format wiki #LANGUAGE it <<BR>> <<Indice>> {{attachment:IconsPage/terminal.png}} Questa pagina descrive come gestire i [[Repository]] dei programmi attraverso la linea di comando. Questo procedimento è necessario ad esempio quando viene utilizzata una installazione minimale, una installazione server (senza un interfaccia grafica utente (GUI)) oppure può essere utile agli utenti che preferiscono questo metodo rispetto ai vari strumenti grafici disponibili in [[Repository/Ubuntu|Gestione dei Repository in Ubuntu]] oppure in [[Repository/Kubuntu|Gestione dei Repository in Kubuntu]]. {{attachment:IconsPage/important.png}} Se stai utilizzando una installazione minimale od una server avrai bisogno di prendere confidenza con un editor di testo da terminale come [[Ufficio/EditorDiTesto/Nano|nano]]. Se stai utilizzango un installazione grafica puoi usare Nano, GEdit o l'editor di testo che più preferisci. = Le Basi = Ubuntu utilizza [[AmministrazioneSistema/Apt|apt]] per la gestione dei pacchetti. Apt memorizza una lista dei Repository e dei canali software nel file {{{ /etc/apt/sources.list}}} Modificando questo file dalla linea di comando, noi possiamo aggiungere, rimuovere o disabilitare temporaneamente i Repository. {{attachment:IconsPage/IconNote.png}} '''Nota:''' È sempre un ottima idea creare una copia di backup di un file di configurazione come '''sources.list''' prima di modificarlo. Per fare questo, utilizzate il seguente comando: {{{ sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup }}} Normalmente, il contenuto di ''/etc/apt/sources.list'' assomiglia a questo: {{{ # sources.list # deb cdrom:[Ubuntu 8.04.1 _Hardy Heron_ - Release amd64 (20080701)]/ hardy main restricted #deb cdrom:[Ubuntu 8.04.1 _Hardy Heron_ - Release amd64 (20080701)]/ hardy main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://us.archive.ubuntu.com/ubuntu/ hardy main restricted deb-src http://us.archive.ubuntu.com/ubuntu/ hardy main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates main restricted deb-src http://us.archive.ubuntu.com/ubuntu/ hardy-updates main restricted }}} {{attachment:IconsPage/important.png}} quello mostrato sopra non è un sources.list completo. == Spiegazione del Formato dei Repository == * Tutte le linee che iniziano con uno o due cancelletti (#) sono commenti e non vengono lette da apt né dai suoi frontend apt-get, Synaptic, Adept, etc... * Le linee senza cancelletti sono ''linee di reposiroty apt''. Le prime due righe apt nel nostro esempio sono: {{{ deb http://us.archive.ubuntu.com/ubuntu/ hardy main restricted deb-src http://us.archive.ubuntu.com/ubuntu/ hardy main restricted }}} * Questo è quello che dicono: * '''deb''': Questi repository contengono pacchetti binari o precompilati. Questi repository sono richiesti per molti utenti. * '''deb-src''': Questi repository contengono il codice sorgente dei pacchetti. Sono utili per gli sviluppatori. * '''http://archive.ubuntu.com/ubuntu''': Questo è l'indirizzo URI (Uniform Resource Identifier), in questo caso un indirizzo di una risorsa su internet. Leggete [[https://launchpad.net/ubuntu/+archivemirrors|official|mirror list]] oppure [[https://wiki.ubuntu.com/Archive|mirror|list]]]] per trovare altri indirizzi di mirror. * '''hardy''' è il nome della release o della versione della tua distribuzione. * '''main''' & '''restricted''' sono i nomi delle sezioni o [[#what|componenti]]. Ci possono essere numerosi nomi di sezioni, separati da spazi. There can be several section names, separated by spaces. == Versioni Future == {{attachment:IconsPage/IconNote.png}} in futuro vorrai sostituire 'hardy' con l'attuale versione che hai installato. Per ciò se hai installato Intrepid il file sources.list dovrebbe assomigliare a questo: {{{ deb http://us.archive.ubuntu.com/ubuntu/ intrepid main restricted deb-src http://us.archive.ubuntu.com/ubuntu/ intrepid main restricted }}} = Aggiungere Repository = == Aggiungere i Repository Universe e Multiverse == È possibile abilitare alcuni Repository aggiuntivi come [[#what|Universe and Multiverse]] decommentando la corrispondente riga apt ( cioé cancellando il '#' all'inizio della riga ). Nel nostro esempio, vogliamo decommentare le righe per Universe: {{{ deb http://us.archive.ubuntu.com/ubuntu/ hardy universe deb-src http://us.archive.ubuntu.com/ubuntu/ hardy universe deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates universe deb-src http://us.archive.ubuntu.com/ubuntu/ hardy-updates universe }}} e le righe per Multiverse: {{{ deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ hardy multiverse deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse }}} {{attachment:IconsPage/IconNote.png}} È importante aggiungere la parte hardy-updates sia di universe che di multiverse per assicurarsi di ricevere gli aggiornamenti. Quando avrai terminato di applicare le tue modifiche salva il file. Ora, recupera la lista aggiornata dei pacchetti dai nuovi Repository aggiungi utilizzando il seguente comando: {{{ sudo apt-get update }}} '''Fatto!''' Il tuo sistema è pronto per installare i pacchetti dai Repository Universe e Multiverse. == Adding Partner Repositoryes == You can add the partner Repositoryes by uncommenting the following lines in your /etc/apt/sources.list file: {{{ deb http://archive.canonical.com/ubuntu hardy partner deb-src http://archive.canonical.com/ubuntu hardy partner }}} Then update as before: {{{ sudo apt-get update }}} {{attachment:IconsPage/important.png}} Be aware that the software contained within this repository is NOT open source. == Adding Other Repositoryes == {{attachment:IconsPage/warning.png}} '''Note:''' There are some (but not many) good reasons for which you might want to add non-Ubuntu Repositoryes to your list of software sources. Some software cannot be distributed by Ubuntu due to patent and licensing restrictions in some countries (see the RestrictedFormats page for examples). You might want to add Repositoryes that offer such software. Make sure that '''all''' Repositoryes you add in this way have been tested and are known to work on Ubuntu systems. Repositoryes that are not designed to work with your version of Ubuntu can introduce inconsistencies in your system and might force you to re-install. ---- * You can add custom software Repositoryes by adding the apt repository line of your software source to the list of Repositoryes. It should look something like this: {{{ deb http://mirror3.ubuntulinux.nl/ hardy-seveas freenx }}} * Add the line at the end of your '''sources.list''' and save the file. * Next, make apt aware of the new software Repositoryes by issuing the following command: {{{ sudo apt-get update }}} * '''Done!''' The new software Repositoryes should now be available for use. == Adding Launchpad PPA Repositoryes == Ubuntu 9.10, Karmic Koala, introduces a convenient new command for adding Launchpad PPA (Personal Package Archive) Repositoryes via the command line: '''add-apt-repository'''. * The repository is registered with APT and an entry is created in the /etc/apt/sources.list.d folder. * If a public key is required and available it is automatically downloaded and registered. {{{ sudo add-apt-repository ppa:<repository-name> }}} '''Example:''' sudo add-apt-repository ppa:nhandler == Enabling Repositoryes with a (non-interactive) Script == {{attachment:IconsPage/IconNote.png}} This section is directed at advanced users. '''Problem:''' You are looking for a way to enable the extra Repositoryes without any user input. <<BR>> '''Example:''' You are creating a custom install script for an application that needs software packages from the Universe or Multiverse Repositoryes. <<BR>> What follows is a simple script that enables the extra Repositoryes that are commented out on a default install of Ubuntu 7.04 LTS. * First, save your original sources.list file. {{{ sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup }}} * Now make the changes to uncomment all Repositoryes listed in the sources.list file. {{{ sudo sed -i -e "s/# deb/deb/g" /etc/apt/sources.list }}} * Make apt aware of the new software Repositoryes by issuing the following command: {{{ sudo apt-get update }}} * '''Done!''' The new software Repositoryes should now be available for use. '''Problem:''' You are looking for a way to enable a repository which you provide for users of your software. * First, save your original sources.list file. {{{ sudo cp /etc/apt/sources.list /etc/apt/sources.list.orig }}} * Now create a new file ending in 'sources.list' in the '/etc/apt/sources.list.d' directory {{{ echo 'deb http://www.yourdomain.com/packages/ubuntu /' >> /etc/apt/sources.list.d/yourdomain.sources.list }}} * Make apt aware of the new software Repositoryes by issuing the following command: {{{ sudo apt-get update }}} * Please be aware that you should sign your packages and ask your users to import your PGP key. Otherwise they will have to confirm that they want to install untrusted packages from your repository. = Suggestions & Recommendations = * It is always a good idea to '''back up''' configuration files like '''/etc/apt/sources.list''' before you begin editing. You can then revert your changes if needed. * If you decide to add other Repositoryes to sources.list, make sure that the repository is '''meant to work (and known to work)''' with Ubuntu. Repositoryes that are '''not designed to work with your version of Ubuntu''' can introduce inconsistencies in your system and might force you to re-install. Also, make sure that you really need to add external Repositoryes as the software package(s) you are looking for may already have been introduced into the official Repositoryes! * Please keep in mind that it may not be legal to enable some ''non-Ubuntu'' software Repositoryes in some countries. * You may be asked enter a security key when adding a non-Ubuntu repository to your sources. See [[Repositoryes/Ubuntu?action=show#head-589d9639c60888f17e3d660b375340777b436077|Managing Authentication Keys]] for instructions. * Remember to retrieve updated package lists by issuing a '''sudo apt-get update''' when you're done editing '''sources.list'''. = Ulteriori Informazioni = * [[https://help.ubuntu.com/community/Repositories/CommandLine|Documento originale]] * [[http://www.debian.org/doc/manuals/apt-howto/index.it.html|Manuale|Utente Debian]] * [[AmministrazioneSistema|Apt|Apt-get]] * [[AmministrazioneSistema/InstallareProgrammi|Installazione Programmi]] * [[http://wiki.debian.org/SecureApt:Secure|Apt]] nel Wiki Debian ---- CategoryHomepage