Wiki Ubuntu-it

Indice
Partecipa
FAQ
Wiki Blog
------------------
Ubuntu-it.org
Forum
Chiedi
Chat
Cerca
Planet
  • Pagina non alterabile
  • Informazioni
  • Allegati

QUESTA PAGINA È IN FASE DI TRADUZIONE. ORIGINALE: https://help.ubuntu.com/community/Repositories/CommandLine #format wiki #LANGUAGE it

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 Gestione dei Repository in Ubuntu oppure in Gestione dei Repository in Kubuntu.

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 nano. Se stai utilizzango un installazione grafica puoi usare Nano, GEdit o l'editor di testo che più preferisci.

Le Basi

Ubuntu utilizza 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.

  • 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

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 official oppure mirror]] 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 componenti. Ci possono essere numerosi nomi di sezioni, separati da spazi. There can be several section names, separated by spaces.

Versioni Future

  • 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 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

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

    IconsPage/important.png Be aware that the software contained within this repository is NOT open source.

Adding Other Repositoryes

[ALLEGA] 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

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.
Example: You are creating a custom install script for an application that needs software packages from the Universe or Multiverse Repositoryes.
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 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


CategoryHomepage