Manuale sparc di Gentoo Linux: Installare Gentoo

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Handbook:SPARC/Full/Installation and the translation is 50% complete.


Introduzione

Benvenuto

Prima di tutto, benvenuto su Gentoo! Stai per entrare nel mondo delle scelte e delle prestazioni. Durante l'installazione di Gentoo, ciò risulterà chiaro in molte occasioni - gli utenti possono scegliere quanto e cosa compilare sulla loro macchina, come installare Gentoo, quale system logger usare, ecc.

Openness

Gentoo's premier tools are built from simple programming languages. Portage, Gentoo's package maintenance system, is written in Python. Ebuilds, which provide package definitions for Portage are written in bash. Our users are encouraged to review, modify, and enhance the source code for all parts of Gentoo.

By default, packages are only patched when necessary to fix bugs or provide interoperability within Gentoo. They are installed to the system by compiling source code provided by upstream projects into binary format (although support for precompiled binary packages is included too). Configuring Gentoo happens through text files.

For the above reasons and others: openness is built-in as a design principle.

Choice

Gentoo è una meta-distribuzione veloce e moderna con un design pulito e flessibile. Gentoo è costruita sull'ecosistema del software libero e non nasconde ai suoi utenti quel che sta sotto il cofano. Portage, il sistema di gestione dei pacchetti che usa Gentoo, è scritto in Python: ciò significa che l'utente ne può facilmente visualizzare e modificare il codice sorgente. Il sistema di impacchettamento di Gentoo usa codice sorgente (sebbene il supporto ai pacchetti precompilati sia disponibile) e la configurazione di Gentoo avviene attraverso semplici file di testo. In altre parole, apertura su tutti i fronti.

When installing Gentoo, choice is made clear throughout the Handbook. System administrators can choose two fully supported init systems (Gentoo's own OpenRC and Freedesktop.org's systemd), partition structure for storage disk(s), what file systems to use on the disk(s), a target system profile, remove or add features on a global (system-wide) or package specific level via USE flags, bootloader, network management utility, and much, much more.

As a development philosophy, Gentoo's authors try to avoid forcing users onto a specific system profile or desktop environment. If something is offered in the GNU/Linux ecosystem, it's likely available in Gentoo. If not, then we'd love to see it so. For new package requests please file a bug report or create your own ebuild repository.

Power

Being a source-based operating system allows Gentoo to be ported onto new computer instruction set architectures and also allows all installed packages to be tuned. This strength surfaces another Gentoo design principal: power.

A system administrator who has successfully installed and customized Gentoo has compiled a tailored operating system from source code. The entire operating system can be tuned at a binary level via the mechanisms included in Portage's make.conf file. If so desired, adjustments can be made on a per-package basis, or a package group basis. In fact, entire sets of functionality can be added or removed using USE flags.

È molto importante che ciascuno comprenda che sono le scelte ciò che permettono a Gentoo di esistere. Proviamo a non forzare nessuno verso qualcosa che non piace. Se qualcuno crede che non sia così, per favore mandi un rapporto bug.

Come è strutturata l'installazione

L'installazione di Gentoo può essere vista come una procedura in 10 passi, corrispondenti ai relativi capitoli. Ogni passo si conclude con una determinata situazione:

Passo Situazione
1 L'utente è in un ambiente di lavoro pronto per l'installazione di Gentoo.
2 La connessione ad Internet è pronta per poter installare Gentoo.
3 I dischi rigidi sono stati inizializzati per ospitare l'installazione di Gentoo.
4 L'ambiente di installazione è stato preparato e l'utente è pronto per fare chroot (cambiare radice) sul nuovo ambiente.
5 I pacchetti fondamentali, gli stessi per tutte le installazioni di Gentoo, sono stati installati.
6 Il kernel Linux è stato installato.
7 La maggior parte dei file di configurazione di Gentoo sono creati.
8 Gli strumenti di sistema necessari sono stati installati.
9 Un appropriato avviatore (bootloader) è stato installato e configurato.
10 L'ambiente Gentoo Linux appena installato è pronto per essere esplorato.

Ogni qualvolta viene presentata una scelta, il manuale cercherà di esporne i pro e i contro. Sebbene il testo continui con la scelta predefinita (identificabile nel titolo con "Predefinito: "), saranno documentate anche le altre possibilità (identificabili nel titolo con "Alternativa: "). La scelta predefinita non deve essere intesa come la scelta raccomandata da Gentoo. Tuttavia, è la scelta che Gentoo ritiene più frequente per la maggior parte degli utenti.

Talvolta si potrà seguire un passo facoltativo. Tali passi sono contrassegnati con "Opzionale: " e quindi non sono necessari per installare Gentoo. Tuttavia, alcuni passi facoltativi sono dipendenti dalle scelte fatte in precedenza. Il manuale informerà il lettore al verificarsi di questa situazione, sia nel momento in cui si compie la scelta, sia giustamente prima che il passo facoltativo sia esposto.

Opzioni di installazione per Gentoo

Gentoo può essere installato in diversi modi. Può essere scaricato e installato dal supporto di installazione ufficiale di Gentoo come le nostre immagini ISO avviabili. Il mezzo di installazione può essere caricato su chiavetta USB o vi si può accedere tramite un ambiente dotato di rete. In alternativa, Gentoo può essere installato da un mezzo non ufficiale, come per esempio una distribuzione già pronta od un disco di avvio non-Gentoo (come Knoppix).

Questo documento affronta l'installazione in riferimento ad un mezzo di installazione ufficiale di Gentoo o, in qualche caso, tramite avvio da rete.

Nota
Per l'assistenza agli altri approcci d'installazione, incluso l'utilizzo di supporto di avvio non-Gentoo, si consiglia di leggere la nostra Guida all'installazione alternativa.

Forniamo anche un documento di consigli e trucchi per l'installazione di Gentoo che potrebbero anch'essi risultare utili.

Problemi

Se venisse trovato un problema nell'installazione (o nella documentazione dell'installazione), si consiglia di visitare il nostro sistema di tracciamento dei bug e di controllare se l'errore è noto. Se non lo è, è consigliabile creare un rapporto bug per esso così potremo occuparcene. Non aver paura degli sviluppatori a cui vengono assegnati i bug - loro (generalmente) non mangiano le persone.

Sebbene questo sia un documento specifico per un'architettura, potrebbe contenere riferimenti anche ad altre architetture, dato che grandi parti del manuale usano del testo comune a tutte le architetture (per evitare la duplicazione degli sforzi). Tali riferimenti sono stati mantenuti al minimo per evitare confusione.

Se c'è qualche dubbio sul fatto che un problema sia o meno strettamente legato all'utente (alcuni errori si possono compiere nonostante un'attenta lettura della documentazione) o se sia un problema del software (alcuni errori possono capitare nonostante un'accurato test dell'installazione e della documentazione), tutti sono invitati ad unirsi al canale #gentoo (webchat) su irc.libera.chat. Naturalmente, chiunque è benvenuto poiché il nostro canale copre l'intero spettro di Gentoo.

A proposito, se ci fossero altre domande riguardo Gentoo, si consiglia di controllare le Domande frequenti. Ci sono anche le FAQ sul Forum di Gentoo.




Requisiti Hardware

Prima di cominciare, elenchiamo i requisiti hardware necessari per installare correttamente Gentoo su un'architettura sparc.


Sparc System Please check the Gentoo Linux/SPARC64 compatibility list or the UltraLinux FAQ
CPU Currently support is limited to SPARC64 CPUs
Memory 64 MB
Disk space 1.5 GB (excluding swap space)
Swap space At least 256 MB

Installation method

Below we cover how to install Gentoo Linux on a sparc system using the minimal installation CD. Gentoo also supports installation from a TFTP netboot image. For more information, please see the Sparc/Netboot article for setting up a netboot server, and find the TFTPBoot images on the Gentoo mirrors under experimental/sparc/tftpboot/sparc64/.


Mezzo di installazione di Gentoo Linux

Suggerimento
While it's recommended to use the official Gentoo boot media when installing, it's possible to use other installation environments. However, there is no guarantee they will contain required components. If an alternate install environment is used, skip to Preparing the disks.

CD d'installazione minimale

Il CD di installazione minimale è un'immagine avviabile: contenente un ambiente Gentoo auto-sostenuto. Permette agli utenti di avviare Linux dal CD o da altri mezzi di installazione. Durante il processo di avvio viene rilevato l'hardware e vengono caricati i driver necessari. L'immagine è mantenuta dagli sviluppatori di Gentoo e consente a chiunque di installarlo purché sia disponibile una connessione ad Internet.

Il CD di installazione minimale è chiamato install-sparc-minimal-<release>.iso.

Il LiveDVD occasionale di Gentoo

Saltuariamente, viene creato una speciale immagine DVD che può essere usato per installare Gentoo. Le istruzioni in questo capitolo riguardano il CD di installazione minimale, pertanto potrebbero risultare un po' differenti rispetto quando si avvia da LiveDVD. Comunque, il LiveDVD (o qualsiasi altro ambiente Linux avviabile) supporta l'elevazione ad amministratore (root) invocando sudo su - oppure sudo -i da terminale.

Gli archivi stage per l'installazione

Un tarball stage3 è un archivio contenente un ambiente Gentoo minimo specifico per il profilo. I tarball Stage3 sono adatti per continuare l'installazione di Gentoo usando le istruzioni in questo manuale. In precedenza, il manuale descriveva l'installazione utilizzando uno dei tre stage tarball. Gentoo non offre più tarball stage1 e stage2 per il download poiché questi sono principalmente per uso interno e per il bootstrap di Gentoo su nuove architetture.

Gli archivi stage3 si possono trovare seguendo il percorso releases/sparc/autobuilds/ su uno dei mirror di Gentoo ufficiali. I file stage vengono aggiornati frequentemente e non sono inclusi nell'immagine ufficiale per l'installazione.

Suggerimento
For now, stage files can be ignored. They will be described in greater detail later when they are needed
Nota
Historically, the handbook described installation steps for stage files with versions lower than 3. These stages contained environments unsuitable for typical installations, and are no longer covered in the handbook.

Download

Scaricare il supporto

I mezzi di installazione predefiniti utilizzati da Gentoo Linux sono i CD minimali di installazione, che ospitano un ambiente Gentoo Linux avviabile e molto piccolo. Questo ambiente contiene tutti gli strumenti appropriati per installare Gentoo. Le stesse immagini dei CD si possono scaricare dalla pagina dei download (raccomandata) o navigando autonomamente fino alla posizione del file ISO su uno dei tanti mirror disponibili.

Navigating Gentoo mirrors

Se si scarica da un mirror, il CD di installazione minimale si potrà trovare così:

  1. Entrare nella cartella releases/.
  2. Scegliere la cartella relativa alla propria architettura (come sparc/).
  3. Scegliere la cartella autobuilds/.
  4. Per le architetture amd64 e x86 scegliere rispettivamente la cartella current-install-amd64-minimal/ o la cartella current-install-x86-minimal/. Per tutte le altre architetture entrare nella cartella current-iso/.
Nota
Alcune architetture come arm, mips, e s390 non hanno un CD d'installazione minimale. Al momento il Progetto ingegneristico di rilasci di Gentoo non supporta la creazione di file .iso per queste architetture.

All'interno di quest'ultima cartella, il file immagine per l'installazione è quello con il suffisso .iso. Per esempio, si dia un'occhiata alla seguente lista:

CODE Lista d'esempio dei file scaricabili su releases/sparc/autobuilds/current-iso/
[DIR] hardened/                                          05-Dec-2014 01:42    -   
[   ] install-sparc-minimal-20141204.iso                 04-Dec-2014 21:04  208M  
[   ] install-sparc-minimal-20141204.iso.CONTENTS        04-Dec-2014 21:04  3.0K  
[   ] install-sparc-minimal-20141204.iso.DIGESTS         04-Dec-2014 21:04  740   
[TXT] install-sparc-minimal-20141204.iso.DIGESTS.asc     05-Dec-2014 01:42  1.6K  
[   ] stage3-sparc-20141204.tar.bz2                      04-Dec-2014 21:04  198M  
[   ] stage3-sparc-20141204.tar.bz2.CONTENTS             04-Dec-2014 21:04  4.6M  
[   ] stage3-sparc-20141204.tar.bz2.DIGESTS              04-Dec-2014 21:04  720   
[TXT] stage3-sparc-20141204.tar.bz2.DIGESTS.asc          05-Dec-2014 01:42  1.5K

Nell'esempio soprastante, il file install-sparc-minimal-20141204.iso è proprio il CD di installazione minimale. Ma come si può osservare, esistono anche altri file:

  • Un file .CONTENTS che contiene una lista di tutti i file disponibili nel supporto di installazione. Può essere molto utile per verificare se sono inclusi alcuni driver senza dover scaricare l'immagine ISO.
  • Un file .DIGESTS che contiene i checksum delle varie immagini ISO, in vari algoritmi. Può essere utilizzato per verificare l'integrità dell'immagine ISO scaricata.
  • Un file .DIGESTS.asc che contiene, oltre ai checksum delle immagini ISO (come nel file .DIGESTS), anche la firma crittografica dei file. Può essere usato, oltre che per verificare l'integrità, per verificare che l'immagine ISO provenga effettivamente dal team di Gentoo e che non sia stata modificata.

Si ignorino per ora gli altri file disponibili in questa posizione - quelli verranno indicati con il procedere dell'installazione. Scaricare il file .iso e, se si desidera la verifica di quanto scaricato, scaricare anche il file .DIGESTS.asc relativo al file .iso. Non è necessario scaricare anche il file .CONTENTS, in quanto queste istruzioni di installazione non vi si riferiranno più, ed il file .DIGESTS dovrebbe contenere le stesse informazioni di .DIGESTS.asc, a parte una firma che quest'ultimo file contiene all'inizio.

Suggerimento
The .DIGESTS file is only needed if the signature in the .iso.asc file is not verified.

Verificare i file scaricati

Nota
Questo è un passaggio facoltativo e non è necessario per l'installazione di Gentoo Linux. Tuttavia, è raccomandato assicurarsi che il file scaricato non sia corrotto e sia effettivamente fornito dalla squadra dell'infrastruttura di Gentoo.
  1. Per prima cosa, viene convalidata la firma crittografica per assicurarsi che il file di installazione sia fornito proprio dalla squadra ingegneristica di rilasci Gentoo
  2. Se la firma crittografica viene validata, si verifica che la somma di controllo (checksum) del file scaricato non sia corrotta

Verifica su un sistema Microsoft Windows

Per verificare prima la firma crittografica, è possibile utilizzare strumenti come GPG4Win. Dopo l'installazione, è necessario importare le chiavi pubbliche della squadra Gentoo Release Engineering. L'elenco delle chiavi è disponibile nella pagina delle firme. Una volta importate, l'utente potrà così verificare la firma del file .DIGESTS.asc.

Verifica su un sistema Linux

Su un sistema Linux, il metodo più comune per verificare la firma crittografica consiste nell'usare app-crypt/gnupg. Con questo pacchetto installato, possono essere usati i seguenti comandi per verificare la firma del file .DIGESTS.asc.

Suggerimento
When importing Gentoo keys, verify that the fingerprint (BB572E0E2D182910) matches.

Per prima cosa, si scarichi il giusto insieme di chiavi rese disponibili sulla pagina delle firme (signature):

user $gpg --keyserver hkps://keys.gentoo.org --recv-keys 0xBB572E0E2D182910
gpg: requesting key 0xBB572E0E2D182910 from hkp server pool.sks-keyservers.net
gpg: key 0xBB572E0E2D182910: "Gentoo Linux Release Engineering (Automated Weekly Release Key) <releng@gentoo.org>" 1 new signature
gpg: 3 marginal(s) needed, 1 complete(s) needed, classic trust model
gpg: depth: 0  valid:   3  signed:  20  trust: 0-, 0q, 0n, 0m, 0f, 3u
gpg: depth: 1  valid:  20  signed:  12  trust: 9-, 0q, 0n, 9m, 2f, 0u
gpg: next trustdb check due at 2018-09-15
gpg: Total number processed: 1
gpg:         new signatures: 1

In alternativa puoi usare invece WKD per scaricare la chiave:

--2019-04-19 20:46:32--  https://gentoo.org/.well-known/openpgpkey/hu/wtktzo4gyuhzu8a4z5fdj3fgmr1u6tob?l=releng
Resolving gentoo.org (gentoo.org)... 89.16.167.134
Connecting to gentoo.org (gentoo.org)|89.16.167.134|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 35444 (35K) [application/octet-stream]
Saving to: 'STDOUT'
 
     0K .......... .......... .......... ....                 100% 11.9M=0.003s
 
2019-04-19 20:46:32 (11.9 MB/s) - written to stdout [35444/35444]
 
gpg: key 9E6438C817072058: 84 signatures not checked due to missing keys
gpg: /tmp/test2/trustdb.gpg: trustdb created
gpg: key 9E6438C817072058: public key "Gentoo Linux Release Engineering (Gentoo Linux Release Signing Key) <releng@gentoo.org>" imported
gpg: key BB572E0E2D182910: 12 signatures not checked due to missing keys
gpg: key BB572E0E2D182910: 1 bad signature
gpg: key BB572E0E2D182910: public key "Gentoo Linux Release Engineering (Automated Weekly Release Key) <releng@gentoo.org>" imported
gpg: Total number processed: 2
gpg:               imported: 2
gpg: no ultimately trusted keys found

Or if using official Gentoo release media, import the key from /usr/share/openpgp-keys/gentoo-release.asc (provided by sec-keys/openpgp-keys-gentoo-release):

user $gpg --import /usr/share/openpgp-keys/gentoo-release.asc
gpg: directory '/home/larry/.gnupg' created
gpg: keybox '/home/larry/.gnupg/pubring.kbx' created
gpg: key DB6B8C1F96D8BF6D: 2 signatures not checked due to missing keys
gpg: /home/larry/.gnupg/trustdb.gpg: trustdb created
gpg: key DB6B8C1F96D8BF6D: public key "Gentoo ebuild repository signing key (Automated Signing Key) <infrastructure@gentoo.org>" imported
gpg: key 9E6438C817072058: 3 signatures not checked due to missing keys
gpg: key 9E6438C817072058: public key "Gentoo Linux Release Engineering (Gentoo Linux Release Signing Key) <releng@gentoo.org>" imported
gpg: key BB572E0E2D182910: 1 signature not checked due to a missing key
gpg: key BB572E0E2D182910: public key "Gentoo Linux Release Engineering (Automated Weekly Release Key) <releng@gentoo.org>" imported
gpg: key A13D0EF1914E7A72: 1 signature not checked due to a missing key
gpg: key A13D0EF1914E7A72: public key "Gentoo repository mirrors (automated git signing key) <repomirrorci@gentoo.org>" imported
gpg: Total number processed: 4
gpg:               imported: 4
gpg: no ultimately trusted keys found

Poi si verifichi la firma crittografica del file .DIGESTS.asc:

user $gpg --verify install-sparc-minimal-20141204.iso.DIGESTS.asc
gpg: Signature made (firma realizzata il) Fri 05 Dec 2014 02:42:44 AM CET
gpg:                using (utilizzando) RSA key 0xBB572E0E2D182910
gpg: Good signature from (firma valida di) "Gentoo Linux Release Engineering (Automated Weekly Release Key) (Chiave a rilascio settimanale automatico) <releng@gentoo.org>" [unknown]
gpg: WARNING (ATTENZIONE): This key is not certified with a trusted signature! (Chiave non certificata con una firma affidabile)
gpg:          There is no indication that the signature belongs to the owner. (Non c'è indicazione che la firma sia stata posta dai suoi proprietari)
Primary key fingerprint (Impronta digitale primaria): 13EB BDBE DE7A 1277 5DFD  B1BA BB57 2E0E 2D18 2910

Per essere assolutamente certi che ogni cosa sia valida, si confronti l'impronta alfanumerica mostrata con l'impronta sulla pagina delle firme di Gentoo.

Nota
It's generally good practice to mark an imported key as trusted, once it's certain the key is trustworthy. When trusted keys are verified, gpg will not say unknown and warn about the signature being untrusted.

Writing the boot media

Naturalmente, con il solo file ISO scaricato, l'installazione di Gentoo Linux non può iniziare. Il file ISO deve essere masterizzato su un CD così da potersi avviare tramite esso, ed in un modo tale che il contenuto del file sia scritto sul CD, non solamente il file stesso. Segue qualche metodo che si avvale di pochi comandi - un insieme più elaborato di istruzioni lo si può trovare su [posso masterizzare un file ISO?].

Writing a bootable USB

Most modern systems support booting from a USB device.

Writing with Linux

dd is typically available on most Linux distros, and can be used to write the Gentoo boot media to a USB drive.

Determining the USB device path

Before writing, the path to the desired storage device must be determined.

dmesg will display detailed information describing the storage device as it is added to the system:

root #dmesg
[268385.319745] sd 19:0:0:0: [sdd] 60628992 512-byte logical blocks: (31.0 GB/28.9 GiB)

Alternatively, lsblk can be used to display available storage devices:

root #lsblk
sdd           8:48   1  28.9G  0 disk
├─sdd1        8:49   1   246K  0 part
├─sdd2        8:50   1   2.8M  0 part
├─sdd3        8:51   1 463.5M  0 part
└─sdd4        8:52   1   300K  0 part

Once the device name has been determined, this can be added to the path prefix /dev/ to get the device path /dev/sdd.

Suggerimento
Using the base device path, ie. sdd opposed to sdd1, is recommend as the Gentoo boot media contains a full GPT partition scheme.
Writing with dd
Attenzione
Be sure to check the target (of=target) path before executing dd, as it will be overwritten.

With the device path (/dev/sdd) and boot media install-amd64-minimal-<release timestamp>.iso ready:

root #dd if=install-amd64-minimal-<release timestamp>.iso of=/dev/sdd bs=4096 status=progress && sync
Nota
if= specifies the input file, of= specifies the output file, which in this case, is a device.
Suggerimento
bs=4096 is used as it speeds up transfers in most cases, status=progress displays transfers stats.

Scrivere su disco

See also
A more elaborate set of instructions can be found in CD/DVD/BD_writing#Image_writing.

Masterizzare con Microsoft Windows

Le versioni di Microsoft Windows 7 e successive possono montare e masterizzare immagini ISO su supporti ottici senza la necessità di software di terze parti. Basta inserire un disco masterizzabile, cercare i file ISO scaricati, fare clic con il pulsante destro del mouse sul file in Esplora risorse e selezionare "Masterizza immagine disco".

Masterizzare con Linux

L'utilità cdrecord dal pacchetto app-cdr/cdrtools può masterizzare immagini ISO su Linux.

Per masterizzare il file ISO sul CD raggiungibile con /dev/sr0 (corrisponde al primo masterizzatore CD nel sistema - sostituirlo con il dispositivo corretto se necessario):

user $cdrecord dev=/dev/sr0 install-sparc-minimal-20141204.iso

Gli utenti che preferiscono un'interfaccia grafica possono usare K3B, incluso nel pacchetto kde-apps/k3b. In K3B, andare su Strumenti e scegliere Masterizza immagine CD.

Avvio

Handbook:SPARC/Blocks/Booting/it

Configurazione hardware extra

Quando il supporto di installazione viene avviato, vengono rilevati tutti i dispositivi hardware e caricati i moduli del kernel appropriati per supportare quell'hardware. Nella maggior parte dei casi fa un ottimo lavoro. Tuttavia, in alcuni casi, può non caricare automaticamente i moduli del kernel necessari al sistema. Se il rilevamento automatico delle periferiche PCI si perde qualche componente hardware, i moduli del kernel appropriati dovranno essere caricati manualmente.

Nel prossimo esempio viene caricato il modulo 8139too (che supporta certi tipi di interfacce di rete):

root #modprobe 8139too

Opzionale: Account utenti

Se altre persone hanno bisogno di accedere all'ambiente di installazione o c'è la necessità di avviare comandi come utenti non-root (ad esempio per chattare utilizzando irssi senza privilegi di root per ragioni di sicurezza), allora è necessario creare un account utente ed impostare una password di root complessa.

Per cambiare la password di root, usare il comando passwd:

root #passwd
New password: (Inserisci la nuova password)
Re-enter password: (Riscrivi la nuova password)

Per creare un account utente, prima si inseriscono le sue credenziali e poi la sua password. I comandi useradd e passwd servono per queste due operazioni.

Nel prossimo esempio, viene creato un utente chiamato "luca":

root #useradd -m -G users luca
root #passwd luca
New password: (Inserisci la password di Luca)
Re-enter password: (Riscrivi la password di Luca)

Per passare dall'attuale utente root a quello appena creato, usare il comando su:

root #su - luca

Opzionale: Consultare la documentazione durante l'installazione

Terminali

Per consultare la guida durante l'installazione, prima si crei un account utente come descritto sopra. Poi si prema Alt+F2 per passare ad un nuovo terminale.

Durante l'installazione, il comando links può essere usato per sfogliare la guida - naturalmente solo se la connessione Internet sta funzionando.

user $links https://wiki.gentoo.org/wiki/Handbook:SPARC/it

Per tornare al terminale di origine, premere Alt+F1.

Suggerimento
When booted to the Gentoo minimal or Gentoo admin environments, seven TTYs will be available. They can be switched by pressing Alt then a function key between F1-F7. It can be useful to switch to a new terminal when waiting for job to complete, to open documentation, etc.

GNU Screen

L'utilità Screen è preinstallata nel supporto di installazione ufficiale di Gentoo. Potrebbe risultare più efficiente per gli appassionati che hanno esperienza con Linux usare screen per visualizzare le istruzioni di installazione in più pannelli anziché con il metodo dei terminali multipli appena esposto.

Opzionale: Avviare il demone SSH

Per consentire ad altri utenti di accedere al sistema durante l'installazione (magari per essere aiutati durante l'installazione, o farsela fare a distanza), si deve creare un account utente (come descritto sopra) ed anche il processo SSH va avviato.

Per avviare il demone SSH su un init OpenRC, eseguire il comando seguente:

root #rc-service sshd start
Nota
Se gli utenti accedono al sistema, vedranno un messaggio che indica che è necessario confermare la chiave del computer host, attraverso la cosiddetta impronta digitale. Ciò è normale dato che si accede al sistema per la prima volta. Tuttavia, in seguito, quando il sistema sarà configurato e qualcuno accederà al sistema appena installato, il client SSH avviserà che il codice del computer host è cambiato. Ciò avviene perché l'utente che si connetterà dopo l'installazione di Gentoo, si troverà non più sull'ambiente di installazione, ma sul nuovo sistema appena installato. Seguire le istruzioni date per sostituire la chiave host sul sistema client.

Per poter usare sshd, la rete deve funzionare correttamente. Proseguire con il capitolo su come Configurare la rete.




Rilevamento automatico della rete

Può la rete funzionare fin da subito?

Se il sistema è connesso via ethernet ad una rete con un server DHCP, è molto probabile che la configurazione sia stata già fatta automaticamente. Se è così, molti comandi da CD che richiedono una connessione di rete funzioneranno immediatamente (es. ssh, scp, ping, irssi, wget e links).

Usare DHCP

DHCP (Dynamic Host Configuration Protocol) (Protocollo di Configurazione Dinamica degli Host) rende possibile ricevere automaticamente informazioni di rete (quali indirizzo IP, maschera di rete, indirizzo di broadcast, gateway, server DNS, ecc.). Ciò funziona solo se esiste un server DHCP nella rete (o se il provider fornisce un servizio DHCP). Per fornire automaticamente queste informazioni all'interfaccia di rete, usare dhcpcd:

DHCP requires that a server be running on the same Layer 2 (Ethernet) segment as the client requesting a lease. DHCP is often used on RFC1918 (private) networks, but is also used to acquire public IP information from ISPs.

Suggerimento
Official Gentoo boot media runs dhcpcd automatically at startup. This behavior can be disabled by adding the nodhcp argument to the boot media kernel commandline.

If it is not already running, dhcpcd can be started on enp1s0 with:

root #dhcpcd eth0

Alcuni amministratori di rete richiedono che l'hostname ed il domain name generati dal server DHCP vengano utilizzati dal sistema. In tal caso, usare:

root #dhcpcd -HD eth0

To stop dhcpcd, -x can be used:

root #dhcpcd -x
sending signal Term to pid 10831
waiting for pid 10831 to exit
See also
Dhcpcd usage

Testare la rete

A properly configured default route is a critical component of Internet connectivity, route configuration can be checked with:

root #ip route
default via 192.168.0.1 dev enp1s0

If no default route is defined, Internet connectivity is unavailable, and additional configuration is required.

Basic internet connectivity can be confirmed with a ping:

root #ping -c 3 1.1.1.1
Suggerimento
It's helpful to start by pinging a known IP address instead of a hostname. This can isolate DNS issues from basic Internet connectivity issues.

Outbound HTTPS access and DNS resolution can be confirmed with:

root #curl --location gentoo.org --output /dev/null

Se tutto funziona, il resto di questo capitolo può essere saltato, passando direttamente al prossimo capitolo (Preparare i dischi).

If curl reports an error, but Internet-bound pings work, DNS may need configuration.

If Internet connectivity has not been established, first interface information should be verified, then:

Determinare i nomi delle interfacce

If networking doesn't work out of the box, additional steps must be taken to enable Internet connectivity. Generally, the first step is to enumerate host network interfaces.

Alternativamente a ifconfig, per determinare i nomi delle interfacce si può utilizzare il comando ip. L'esempio seguente mostra l'output di ip addr (il risultato differisce dal precedente poiché eseguito su un sistema diverso):

The link argument can be used to display network interface links:

root #ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
4: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether e8:40:f2:ac:25:7a brd ff:ff:ff:ff:ff:ff

The address argument can be used to query device address information:

root #ip addr
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether e8:40:f2:ac:25:7a brd ff:ff:ff:ff:ff:ff
    inet 10.0.20.77/22 brd 10.0.23.255 scope global eno1
       valid_lft forever preferred_lft forever
    inet6 fe80::ea40:f2ff:feac:257a/64 scope link 
       valid_lft forever preferred_lft forever

The output of this command contains information for each network interface on the system. Entries begin with the device index, followed by the device name: enp1s0.

Suggerimento
Se usando il comando ifconfig non viene mostrata alcuna interfaccia, si può provare ad usare lo stesso comando con l'opzione -a. Questa opzione fa sì che vengano mostrate tutte le interfacce rilevate dal sistema, che esse siano abilitate o meno. Se ifconfig -a non mostra risultati, la scheda di rete potrebbe essere guasta o il relativo driver non caricato nel kernel. Queste situazioni vanno oltre lo scopo di questo manuale. Contattare #gentoo (webchat) per avere supporto tecnico.

Nella parte rimanente del documento, il manuale considererà che l'interfaccia di rete sia chiamata eth0.

Avendo adottato nomi che indicano il tipo di interfaccia, il nome dell'interfaccia di rete potrebbe essere abbastanza diverso dal classico eth0. I dischi di installazione recenti potrebbero riportare nomi come eno0, ens1, o enp5s0. Si cerchi con ifconfig l'interfaccia che ha un indirizzo IP correlato alla rete locale.

Optional: Application specific configuration

The following methods are not generally required, but may be helpful in situations where additional configuration is required for Internet connectivity.

Opzionale: Configurazione dei proxy

Se si accede ad Internet attraverso un proxy, è necessario impostarlo durante l'installazione. Configurare un proxy è molto facile: basta definire una variabile con le informazioni del server proxy.

Certain text-mode web browsers such as links can also make use of environment variables that define web proxy settings; in particular for the HTTPS access it also will require the https_proxy environment variable to be defined. While Portage will be influenced without passing extra run time parameters during invocation, links will require proxy settings to be set.

Nella maggior parte dei casi, è sufficiente definire la variabile con l'hostname del server. Per esempio, il proxy è chiamato proxy.gentoo.org e la porta è 8080.

Nota
The # symbol in the following commands is a comment. It has een added for clarity only and does not need to be typed when entering the commands.

Per impostare un proxy HTTP (per il traffico HTTP/HTTPS):

root #export http_proxy="http://proxy.gentoo.org:8080"

Se il proxy richiede nome utente e password, usare la seguente sintassi per la variabile:

CODE Aggiungere nome utente e password alla variabile del proxy
http://username:password@proxy.gentoo.org:8080

Start links using the following parameters for proxy support:

user $links -http-proxy ${http_proxy} -https-proxy ${https_proxy}

Per configurare un proxy FTP:

root #export ftp_proxy="ftp://proxy.gentoo.org:8080"

Start links using the following parameter for a FTP proxy:

user $links -ftp-proxy ${ftp_proxy}

Per configurare un proxy RSYNC:

root #export RSYNC_PROXY="proxy.gentoo.org:8080"

Alternativa: Usare PPP

If PPPoE is required for Internet access, the Gentoo boot media includes the pppoe-setup script to simplify ppp configuration.

During setup, pppoe-setup will ask for:

  • The name of the Ethernet interface connected to the ADSL modem.
  • The PPPoE username and password.
  • DNS server IPs.
  • Whether or not a firewall is needed.
root #pppoe-setup
root #pppoe-start

In the event of failure, credentials in /etc/ppp/pap-secrets or /etc/ppp/chap-secrets should be verified. If credentials are correct, PPPoE Ethernet interface selection should be checked.

Alternativa: Usare PPTP

Se è necessario il supporto PPTP, usare pptpclient fornito dai CD di installazione. Prima però ci si assicuri che la configurazione sia corretta, modificando /etc/ppp/pap-secrets o /etc/ppp/chap-secrets affinché contengano la giusta combinazione di nome utente e password:

Edit /etc/ppp/pap-secrets or /etc/ppp/chap-secrets so it contains the correct username/password combination:

root #nano -w /etc/ppp/chap-secrets

Poi, se necessario, modificare /etc/ppp/options.pptp:

root #nano -w /etc/ppp/options.pptp

Una volta fatto tutto ciò, si esegua pptp (insieme alle opzioni che non potevano essere impostate su options.pptp) per connettersi al server:

root #pptp <server ipv4 address>

Preparare l'accesso wireless

Attenzione
Do not use WEP unless it is the only option. WEP provides essentially no security over an open network.
Nota
Il supporto del comando iw potrebbe avere caratteristiche specifiche in base all'architettura. Se il comando non è disponibile, controllare che sia disponibile il pacchetto net-wireless/iw per l'architettura in uso. Il comando iw è disponibile solo se il pacchetto net-wireless/iw è installato.

Quando si utilizza una scheda wireless (802.11), è necessario configurare le impostazioni wireless prima di andare avanti. Per visualizzare le impostazioni della scheda wireless, è possibile utilizzare iw. L'esecuzione di iw potrebbe mostrare qualcosa di simile a questo:

root #iw dev wlp9s0 info
Interface wlp9s0
	ifindex 3
	wdev 0x1
	addr 00:00:00:00:00:00
	type managed
	wiphy 0
	channel 11 (2462 MHz), width: 20 MHz (no HT), center1: 2462 MHz
	txpower 30.00 dBm

Per controllare la connessione in corso:

root #iw dev wlp9s0 link
Not connected.

oppure

root #iw dev wlp9s0 link
Connected to 00:00:00:00:00:00 (on wlp9s0)
	SSID: GentooNode
	freq: 2462
	RX: 3279 bytes (25 packets)
	TX: 1049 bytes (7 packets)
	signal: -23 dBm
	tx bitrate: 1.0 MBit/s
Nota
Alcune schede wireless possono avere un nome di periferica tipo wlan0 o ra0 anziché wlp9s0. Eseguire ip link per stabilire il nome corretto del dispositivo.

Per la maggior parte degli utenti, sono necessarie solo due impostazioni per potersi connettere, l'ESSID (anche conosciuto come nome di rete wireless) e, opzionalmente, la chiave WEP.

  • Prima di tutto, assicurarsi che l'interfaccia sia attiva:
root #ip link set dev wlp9s0 up
  • Per connettersi ad una rete libera chiamata GentooNode:
root #iw dev wlp9s0 connect -w GentooNode
  • Per connettersi con una chiave WEP esadecimale, anteporre alla chiave il prefisso d::
root #iw dev wlp9s0 connect -w GentooNode key 0:d:1234123412341234abcd
  • Per connettersi con una chiave WEP ASCII:
root #iw dev wlp9s0 connect -w GentooNode key 0:una-certa-password
Nota
Se la rete wireless è configurata con WPA o WPA2, allora si deve usare wpa_supplicant. Per ulteriori informazioni sulla configurazione delle reti wireless in Gentoo Linux, leggere il Capitolo sulle reti wireless nel Manuale di Gentoo.

Confermare le impostazioni della rete wireless usando iw dev wlp9s0 link. Una volta che la rete wireless funziona, proseguire con la configurazione delle opzione di rete per il livello IP come descritto nella sezione successiva (Comprendere la terminologia delle reti) od usando lo strumento net-setup come descritto precedentemente.

Configurazione automatica della rete

In cases where automatic network configuration is unsuccessful, the Gentoo boot media provides scripts to aid in network configuration. net-setup can be used to configure wireless network information and static IPs.

root #net-setup eth0

net-setup chiederà alcune informazioni sull'ambiente di rete. Quando avrà concluso, la rete dovrebbe funzionare. Si provi la connessione di rete come precedentemente indicato. Se il test è positivo, congratulazioni! Saltare il resto di questa sezione e continuare con la Preparazione dei dischi.

Importante
Network status should be tested after any configuration steps are taken. In the event that configuration scripts do not work, manual network configuration is required.

Comprendere la terminologia delle reti

If all of the above fails, the network must be configured manually. This is not particularly difficult, but should be done with consideration. This section serves to clarify terminology and introduce users to basic networking concepts pertaining to manually configuring an Internet connection.

Suggerimento
Some CPE (Carrier Provided Equipment) combines the functions of a router, access point, modem, DHCP server, and DNS server into one unit. It's important to differentiate the functions of a device from the physical appliance.

Interfaces and addresses

Network interfaces are logical representations of network devices. An interface needs an address to communicate with other devices on the network. While only a single address is required, multiple addresses can be assigned to a single interface. This is especially useful for dual stack (IPv4 + IPv6) configurations.

For consistency, this primer will assume the interface enp1s0 will be using the address 192.168.0.2.

Importante
IP addresses can be set arbitrarily. As a result, it's possible for multiple devices to use the same IP address, resulting in an address conflict. Address conflicts should be avoided by using DHCP or SLAAC.
Suggerimento
IPv6 typically uses StateLess Address AutoConfiguration (SLAAC) for address configuration. In most cases, manually setting IPv6 addresses is a bad practice. If a specific address suffix is preferred, interface identification tokens can be used.

Networks and CIDR

Once an address is chosen, how does a device know how to talk to other devices?

IP addresses are associated with networks. IP networks are contiguous logical ranges of addresses.

Classless Inter-Domain Routing or CIDR notation is used to distinguish network sizes.

  • The CIDR value, often notated starting with a /, represents the size of the network.
    • The formula 2 ^ (32 - CIDR) can be used to calculate network size.
    • Once network size is calculated, usable node count must be reduced by 2.
      • The first IP in a network is the Network address, and the last is typically the Broadcast address. These addresses are special and cannot be used by normal hosts.
Suggerimento
The most common CIDR values are /24, and /32, representing 254 nodes and a single node respectively.

A CIDR of /24 is the de-facto default network size. This corresponds to a subnet mask of 255.255.255.0, where the last 8 bits are reserved for IP addresses for nodes on a network.

The notation: 192.168.0.2/24 can be interpreted as:

  • The address 192.168.0.2
  • On the network 192.168.0.0
  • With a size of 254 (2 ^ (32 - 24) - 2)
    • Usable IPs are in the range 192.168.0.1 - 192.168.0.254
  • With a broadcast address of 192.168.0.255
    • In most cases, the last address on a network is used as the broadcast address, but this can be changed.

Using this configuration, a device should be able to communicate with any host on the same network (192.168.0.0).

The Internet

Once a device is on a network, how does it know how to talk to devices on the Internet?

To communicate with devices outside of local networks, routing must be used. A router is simply a network device that forwards traffic for other devices. The term default route or gateway typically refers to whatever device on the current network is used for external network access.

Suggerimento
It's a standard practice to make the gateway the first or last IP on a network.

If an Internet-connected router is available at 192.168.0.1, it can be used as the default route, granting Internet access.

To summarize:

  • Interfaces must be configured with an address and network information, such as the CIDR value.
  • Local network access is used to access a router on the same network.
  • The default route is configured, so traffic destined for external networks is forwarded to the gateway, providing Internet access.

The Domain Name System

Remembering IPs is hard. The Domain Name System was created to allow mapping between Domain Names and IP addresses.

Linux systems use /etc/resolv.conf to define nameservers to be used for DNS resolution.

Suggerimento
Many routers can also function as a DNS server, and using a local DNS server can augment privacy and speed up queries through caching.

Many ISPs run a DNS server that is generally advertised to the gateway over DHCP. Using a local DNS server tends to improve query latency, but most public DNS servers will return the same results, so server usage is largely based on preference.

Configurazione manuale della rete

Interface address configuration

Importante
When manually configuring IP addresses, the local network topology must be considered. IP addresses can be set arbitrarily; conflicts may cause network disruption.

To configure enp1s0 with the address 192.168.0.2 and CIDR /24:

root #ip address add 192.168.0.2/24 dev enp1s0
Suggerimento
The start of this command can be shortened to ip a.

Default route configuration

Configuring address and network information for an interface will configure link routes, allowing communication with that network segment:

root #ip route
192.168.0.0/24 dev enp1s0 proto kernel scope link src 192.168.0.2
Suggerimento
This command can be shortened to ip r.

The default route can be set to 192.168.0.1 with:

root #ip route add default via 192.168.0.1

DNS configuration

Nameserver info is typically acquired using DHCP, but can be set manually by adding nameserver entries to /etc/resolv.conf.

Attenzione
If dhcpcd is running, changes to /etc/resolv.conf will not persist. Status can be checked with ps x | grep dhcpcd.

nano is included in Gentoo boot media and can be used to edit /etc/resolv.conf with:

root #nano -w /etc/resolv.conf

Lines containing the keyword nameserver followed by a DNS server IP address are queried in order of definition:

FILE /etc/resolv.confUse Quad9 DNS.
nameserver 9.9.9.9
nameserver 149.112.112.112
FILE /etc/resolv.confUse Cloudflare DNS.
nameserver 1.1.1.1
nameserver 1.0.0.1

DNS status can be checked by pinging a domain name:

root #ping -c 3 gentoo.org

Once connectivity has been verified, continue with Preparing the disks.




Introduzione ai dispositivi a blocchi

Dispositivi a blocchi

Approfondiamo ora gli aspetti relativi ai dischi di Gentoo Linux e Linux in generale, compresi i filesystem, le partizioni e i dispositivi a blocchi di Linux. Appena tutto sarà chiaro in merito ai filesystem, allora partizioni e filesystem potranno essere scelti per installare Gentoo Linux.

Per iniziare, diamo un'occhiata ai dispositivi a blocchi. Quello più noto è solitamente il primo disco in un sistema Linux, ovvero /dev/sda. I dischi SCSI e Serial ATA sono entrambi chiamati /dev/sd*; persino i dispositivi IDE sono etichettati /dev/sd* quando si usa il framework libata nel kernel. Invece, con il framework (libreria di codici) dei vecchi dispositivi, il primo disco IDE è /dev/hda.

The following table will help readers determine where to find a certain type of block device on the system:

Type of device Default device handle Editorial notes and considerations
IDE, SATA, SAS, SCSI, or USB flash /dev/sda Found on hardware from roughly 2007 until the present, this device handle is perhaps the most commonly used in Linux. These types of devices can be connected via the SATA bus, SCSI, USB bus as block storage. As example, the first partition on the first SATA device is called /dev/sda1.
NVM Express (NVMe) /dev/nvme0n1 The latest in solid state technology, NVMe drives are connected to the PCI Express bus and have the fastest transfer block speeds on the market. Systems from around 2014 and newer may have support for NVMe hardware. The first partition on the first NVMe device is called /dev/nvme0n1p1.
MMC, eMMC, and SD /dev/mmcblk0 embedded MMC devices, SD cards, and other types of memory cards can be useful for data storage. That said, many systems may not permit booting from these types of devices. It is suggested to not use these devices for active Linux installations; rather consider using them to transfer files, which is their typical design intention. Alternatively this storage type could be useful for short-term file backups or snapshots.

I dispositivi a blocchi di cui sopra rappresentano un'interfaccia astratta del disco. I programmi dell'utente possono usare questi dispositivi a blocchi per interagire col disco senza doversi preoccupare del fatto che i dischi siano IDE, SCSI o altro. Il programma può semplicemente indirizzare lo spazio sul disco come un insieme di blocchi da 512 byte contigui e accessibili in modo casuale.

Handbook:SPARC/Blocks/Disks/it

Creazione dei file system

Attenzione
When using SSD or NVMe drive, it is wise to check for firmware upgrades. Some Intel SSDs in particular (600p and 6000p) require a firmware upgrade for possible data corruption induced by XFS I/O usage patterns. The problem is at the firmware level and not any fault of the XFS filesystem. The smartctl utility can help check the device model and firmware version.

Introduzione

Una volta create le partizioni, è ora di inserirci un filesystem. Nella sezione successiva vengono descritti i file system supportati da Linux. I lettori che sanno già quale filesystem usare possono continuare con la sezione Applicare un filesystem ad una partizione. Gli altri lettori dovrebbero continuare a leggere per comprendere meglio i filesystem disponibili...

Filesystem

Sono disponibili numerosi filesystem. Alcuni di essi sono ritenuti stabili sull'architettura sparc - è consigliabile informarsi sui filesystem e sul loro supporto, prima di selezionarne uno più sperimentale da usare su partizioni importanti.

btrfs
È un filesystem di nuova generazione che fornisce molte caratteristiche avanzate, come la possibilità di creare istantanee, l'auto-riparazione tramite checksum, la compressione trasparente, i sottovolumi e il RAID integrato. Alcune distribuzioni hanno iniziato ad offrirlo come opzione standard, ma non è pronto per la produzione. Sono frequenti i rapporti di corruzione del filesystem. I suoi sviluppatori spingono la gente ad utilizzare la versione più recente del kernel, perché quelle più vecchie è noto che causino problemi. Così è stato per anni ed è troppo presto per dire se le cose sono cambiate. Le correzioni dei problemi di corruzione raramente vengono trasferite sui kernel più vecchi. Si proceda con cautela quando si utilizza questo filesystem!
ext2
È l'effettivo e collaudato filesystem di Linux, ma non ha il journaling dei metadati, il ché significa che i controlli di routine del filesystem ext2 effettuati all'avvio possono richiedere molto tempo. Ormai esiste una scelta piuttosto ampia di filesystem con journaling, la cui consistenza può essere controllata molto velocemente e sono infatti generalmente preferiti rispetto alle controparti senza journaling. I filesystem con journaling prevengono lunghi ritardi qualora il sistema si avvii con il filesystem in uno stato inconsistente (errori di coerenza).
ext3
È la versione con journaling del filesystem ext2, che fornisce il journaling dei metadati per un ripristino veloce in aggiunta ad altre modalità migliorate di journaling come quello a dati completi e a dati ordinati. Usa un indice HTree che permette alte prestazioni in quasi tutte le situazioni. In breve, ext3 è un filesystem molto buono e affidabile.
ext4
Inizialmente creato come un derivato di ext3, ext4 porta nuove caratteristiche, miglioramenti delle prestazioni e rimozione dei limiti delle dimensioni con lievi modifiche al formato su disco. Può ospitare volumi fino a 1 EB e con una dimensione massima dei file di 16 TB. Invece della classica allocazione a blocchi bitmap di ext2-3, ext4 utilizza le estensioni, che migliorano le prestazioni con file grandi e riducono la frammentazione. Ext4 fornisce anche algoritmi di allocazione dei blocchi più sofisticati (allocazione ritardata e multiblocco) dando ai driver del filesystem più modi per ottimizzare la distribuzione dei dati su disco. Ext4 è il filesystem raccomandato per tutti gli utilizzi e per tutte le piattaforme.
f2fs
Il Flash-Friendly File System fu originariamente creato da Samsung per essere usato con la memoria flash NAND. Nel secondo quadrimestre del 2016, questo filesystem era considerato ancora immaturo, ma è una scelta decente quando si installa Gentoo su microSD, dischi USB, o altri dispositivi di memoria basati su flash.
JFS
È il filesystem ad alte prestazioni di IBM. JFS è un filesystem leggero, veloce e affidabile basato su B+tree con buone prestazioni in varie condizioni.
ReiserFS
È un filesystem con journaling basato su B+tree che ha delle buone prestazioni complessive, specialmente quando si ha a che fare con molti piccoli file al costo di più cicli di CPU. ReiserFS sembra essere meno mantenuto rispetto ad altri filesystem.
XFS
È un filesystem con journaling dei metadati che fornisce un robusto insieme di caratteristiche ed è ottimizzato per la scalabilità. XFS sembra essere meno indulgente in caso di vari problemi hardware.
vfat
Anche conosciuto come FAT32, è supportato da Linux ma non supporta alcuna configurazione dei permessi. È principalmente usato per interoperabilità con altri sistemi operativi (principalmente Microsoft Windows) ma è anche una necessità per alcuni firmware di sistema (come UEFI).
NTFS
Il filesystem "New Technology" è quello principale su Microsoft Windows. Analogamente a vfat, non memorizza le impostazioni dei permessi o gli attributi estesi necessari ai sistemi BSD o Linux affinché funzionino correttamente, di conseguenza non può essere usato come filesystem radice (root). Dovrebbe essere usato solamente per l'interoperabilità con i sistemi Microsoft Windows (si noti l'enfasi su solamente).

More extensive information on filesystems can be found in the community maintained Filesystem article.

Applicare un filesystem ad una partizione

Nota
Please make sure to emerge the relevant user space utilities package for the chosen filesystem before rebooting. There will be a reminder to do so near the end of the installation process.

Per creare un filesystem su una partizione o su un volume, ci sono strumenti avviabili dallo spazio utente per ogni possibile filesystem. Cliccare sul nome del filesystem nella tabella sottostante per informazioni aggiuntive su ciascun filesystem:

Filesystem Comando di creazione Sul CD minimale? Pacchetto
btrfs mkfs.btrfs sys-fs/btrfs-progs
ext2 mkfs.ext2 sys-fs/e2fsprogs
ext3 mkfs.ext3 sys-fs/e2fsprogs
ext4 mkfs.ext4 sys-fs/e2fsprogs
f2fs mkfs.f2fs sys-fs/f2fs-tools
jfs mkfs.jfs sys-fs/jfsutils
reiserfs mkfs.reiserfs sys-fs/reiserfsprogs
xfs mkfs.xfs sys-fs/xfsprogs
vfat mkfs.vfat sys-fs/dosfstools
NTFS mkfs.ntfs sys-fs/ntfs3g
Importante
The handbook recommends new partitions as part of the installation process, but it is important to note running any mkfs command will erase any data contained within the partition. When necessary, ensure any data that exists within is appropriately backed up before creating a few filesystem.

Per esempio, per avere la partizione root (/dev/sda1) in ext4 come nello schema delle partizioni d'esempio, si devono usare i seguenti comandi:

root #mkfs.ext4 /dev/sda1

EFI system partition filesystem

The EFI system partition () must be formatted as FAT32:

Legacy BIOS boot partition filesystem

Systems booting via legacy BIOS with a MBR/DOS disklabel can use any filesystem format supported by the bootloader.

For example, to format with XFS:

root #mkfs.xfs

Small ext4 partitions

Quando si usa ext2, ext3 o ext4 su una piccola partizione (minore di 8GB), allora il filesystem deve essere creato con le opzioni appropriate per riservare abbastanza inode. L'applicazione mke2fs mkfs.ext2 usa l'impostazione "bytes-per-inode" per calcolare quanti inode dovrebbe avere un filesystem. Su partizioni più piccole, è consigliato aumentare il numero di inode calcolati.

root #mkfs.ext2 -T small /dev/<dispositivo>

Questa scelta generalmente quadruplica il numero di inode per un certo filesystem poiché i suoi "bytes-per-inode" anziché uno ogni 16kB diventano uno ogni 4kB. Ciò può essere ulteriormente modificato specificando la proporzione:

Attivazione della partizione di swap

mkswap è il comando che viene usato per inizializzare la partizione di swap:

root #mkswap /dev/sda2

Per attivare la partizione di swap, usare swapon:

root #swapon /dev/sda2

This 'activation' step is only necessary because the swap partition is newly created within the live environment. Once the system has been rebooted, as long as the swap partition is properly defined within fstab or other mount mechanism, swap space will activate automatically.

Montaggio della partizione di root

Nota
Installations which were previously started, but did not finish the installation process can resume the installation from this point in the handbook. Use this link as the permalink: Resumed installations start here.

Certain live environments may be missing the suggested mount point for Gentoo's root partition (), or mount points for additional partitions created in the partitioning section:

root #mkdir --parents

For EFI installs only, the ESP should be mounted under the root partition location:

root #mkdir --parents

Continue creating additional mount points necessary for any additional (custom) partition(s) created during previous steps by using the mkdir command.

Ora che le partizioni sono inizializzate ed ospitano un filesystem, è tempo di montare quelle partizioni. Usare il comando mount, ma non dimenticarsi di creare le directory (cartelle) di montaggio necessarie su cui montare ogni partizione creata. Nell'esempio è riportato come montare la partizione di root:

Mount the root partition:

root #mount /dev/sda1 /mnt/gentoo

Continue mounting additional (custom) partitions as necessary using the mount command.

Nota
Se è necessario che /tmp/ risieda su una partizione separata, assicurarsi di cambiare i suoi permessi dopo averla montata:
root #chmod 1777 /mnt/gentoo/tmp
Ciò è valido anche per /var/tmp.

Più avanti nel manuale, il filesystem proc (un'interfaccia virtuale fornita dal kernel) ed altri pseudo-filesystem del kernel verranno montati. Però prima è necessario Installare i file di installazione di Gentoo.




Scegliere uno stage tarball

Suggerimento
On supported architectures, it is recommended for users targeting a desktop (graphical) operating system environment to use a stage file with the term desktop within the name. These files include packages such as sys-devel/llvm and dev-lang/rust-bin and USE flag tuning which will greatly improve install time.

The stage file acts as the seed of a Gentoo install. Stage files are generated with Catalyst by the Release Engineering Team. Stage files are based on specific profiles, and contain an almost-complete system.

When choosing a stage file, it's important to pick one with profile targets corresponding to the desired system type.

Importante
While it's possible to make major profile changes after an installation has been established, switching requires substantial effort and consideration, and is outside the scope of this installation manual. Switching init systems is difficult, but switching from no-multilib to multilib requires extensive Gentoo and low-level toolchain knowledge.

La maggior parte degli utenti non dovrebbe usare le opzioni 'avanzate' dei tarball; infatti queste riguardano specifiche configurazioni software o hardware.

OpenRC

OpenRC is a dependency-based init system (responsible for starting up system services once the kernel has booted) that maintains compatibility with the system provided init program, normally located in /sbin/init. It is Gentoo's native and original init system, but is also deployed by a few other Linux distributions and BSD systems.

OpenRC does not function as a replacement for the /sbin/init file by default and is 100% compatible with Gentoo init scripts. This means a solution can be found to run the dozens of daemons in the Gentoo ebuild repository.

systemd

systemd is a modern SysV-style init and rc replacement for Linux systems. It is used as the primary init system by a majority of Linux distributions. systemd is fully supported in Gentoo and works for its intended purpose. If something seems lacking in the Handbook for a systemd install path, review the systemd article before asking for support.

Multilib (32 e 64 bit)

Nota
Not every architecture has a multilib option. Many only run with native code. Multilib is most commonly applied to amd64.

Scegliere un tarball base per il sistema fa risparmiare una quantità considerevole di tempo lungo il processo di installazione, in particolare quando si dovrà scegliere un profilo corretto. La selezione di uno stage tarball avrà implicazioni dirette sulla configurazione del futuro sistema e può anche prevenire possibili problemi futuri. Il tarball multilib usa librerie a 64 bit ogni volta che è possibile, mentre solo per ragioni di compatibilità passa ai 32 bit. Questa è un'eccellente scelta per la maggior parte delle installazioni, dato che offre grande flessibilità per una personalizzazione futura. Per coloro che desiderano che il loro sistema sia in grado di passare facilmente da un profilo all'altro dovrebbero scegliere un tarbal multilib in relazione all'architettura del loro processore.

Suggerimento
Using multilib targets makes it easier to switch profiles later, compared to no-multilib

Non multilib (64 bit puro)

Attenzione
Siate consapevoli che migrare da un sistema no-multilib ad uno multilib richiede una conoscenza di Gentoo molto collaudata, oltre ad una serie di strumenti di basso livello (ciò potrebbe far preoccupare persino i nostri sviluppatori di strumenti (toolchain)). Non è per i deboli di cuore e va oltre lo scopo di questa guida.

Scegliere un tarball non multilib come base per il sistema offre un ambiente completamente a 64 bit. Ciò rende improbabile il passaggio ad un profilo multilib, seppur possibile. Coloro che cominciano ad usare Gentoo non dovrebbero scegliere un tarball no-multilib a meno che non sia assolutamente necessario.

Scaricamento dello stage tarball

Impostare data e ora

Stage archives are generally obtained using HTTPS which requires relatively accurate system time. Clock skew can prevent downloads from working, and can cause unpredictable errors if the system time is adjusted by any considerable amount after installation.

Verificare data e ora eseguendo il comando date:

root #date
Lun 3 Ott 13:16:22 CET 2016

Se la data/ora mostrata è sbagliata, correggerla usando uno dei seguenti metodi.

Automatico

Using NTP to correct clock skew is typically easier and more reliable than manually setting the system clock.

chronyd, part of net-misc/chrony can be used to update the system clock to UTC with:

root #ntpd -q -g
Importante
Systems without a functioning Real-Time Clock (RTC) must sync the system clock at every system start, and on regular intervals thereafter. This is also beneficial for systems with a RTC, as the battery could fail, and clock skew can accumulate.
Attenzione
Standard NTP traffic not authenticated, it is important to verify time data obtained from the network.

Manuale

When NTP access is unavailable, date can be used to manually set the system clock.

L'orario UTC è raccomandato su tutti i sistemi Linux. Successivamente, durante l'installazione, verrà definito un fuso orario. Ciò modificherà il modo in cui viene mostrata l'ora in base all'ora locale.

Il comando date può essere usato anche per effettuare un'impostazione manuale dell'orologio di sistema. Usare la sintassi MMGGoommAAAA (Mese, Giorno, ora, minuti e anno).

Per esempio, per impostare la data sul 3 ottobre, 13:16 nell'anno 2016:

root #date 100313162016

Spostarsi sulla cartella dove è stato montato il filesystem radice di Gentoo (molto probabilmente /mnt/gentoo):

root #cd /mnt/gentoo

Browser grafici

Coloro che usano ambienti con browser di rete completamente grafici non avranno problemi a copiare l'URL del file stage dalla sezione di download del sito principale. Semplicemente selezionare la scheda appropriata, cliccare con il tasto destro del mouse sul collegamento al file stage, poi Copiare l'indirizzo (su Firefox) o Copiare la posizione (su Chromium) per copiare l'indirizzo negli appunti, incollare poi il collegamento all'utilità wget da linea di comando così da scaricare lo stage tarball:

root #wget <URL_STAGE_INCOLLATO>

Browser a linea di comando

I lettori più tradizionali o gli utenti Gentoo di 'vecchia data', lavorando esclusivamente da linea di comando, potrebbero preferire l'uso di links, un browser senza grafica e basato sui menu. Per scaricare uno stage, navigare fino alla lista di distributori (mirror) di Gentoo come di seguito:

root #links https://www.gentoo.org/downloads/mirrors/

Per usare un proxy HTTP con links, passare l'URL con l'opzione -http-proxy:

root #links -http-proxy proxy.server.com:8080 https://www.gentoo.org/downloads/mirrors/

Oltre a links esiste anche il browser lynx. Come links, si tratta di un browser privo di grafica ma non basato sui menu.

root #lynx https://www.gentoo.org/downloads/mirrors/

Se è necessario definire un proxy, esportare le variabili http_proxy e/o ftp_proxy:

root #export http_proxy="http://proxy.server.com:port"
root #export ftp_proxy="http://proxy.server.com:port"

Nella lista dei distributori (mirror), selezionarne uno vicino. Solitamente vanno bene i mirror HTTP, ma sono disponibili anche altri protocolli. Spostarsi nella cartella releases/sparc/autobuilds/. Qui sono elencati tutti i file stage disponibili (potrebbero essere posti in sottocartelle nominate con il nome delle singole sotto architetture). Selezionarne uno e premere d per scaricarlo.

Appena lo scaricamento del file stage è completato, è possibile verificare l'integrità e validare i contenuti dello stage tarball. Coloro che lo desiderano dovrebbero leggere la successiva sezione.

Coloro che non sono interessati alla verifica e alla validazione del file stage possono chiudere il browser a linea di comando premendo q e possono proseguire alla sezione di estrazione dello stage tarball.

Verifica e validazione

Nota
Most stages are now explicitly suffixed with the init system type (openrc or systemd), although some architectures may still be missing these for now.

Come con i CD di installazione minimali, anche ora sono disponibili file aggiuntivi per verificare e validare il file stage. Sebbene questi passi possano essere saltati, questi file sono forniti per gli utenti che tengono alla legittimità dei file da essi scaricati.

root #wget https://distfiles.gentoo.org/releases/
  • Un file .CONTENTS che contiene un elenco di tutti i file all'interno del tarball stage.
  • Un file .DIGESTS che contiene i checksum (somme di controllo) del file stage, in base a diversi algoritmi.
  • Un file .DIGESTS.asc che, come il file .DIGESTS, contiene i checksum del file stage secondo diversi algoritmi, ma è anche firmato crittograficamente per assicurarsi che sia fornito dal progetto Gentoo.

Usare openssl e confrontare il suo risultato con le somme di controllo fornite dal file .DIGESTS o .DIGESTS.asc.

Per esempio, per validare con il checksum SHA512:

root #openssl dgst -r -sha512 stage3-sparc-<release>.tar.bz2

dgst instructs the openssl command to use the Message Digest sub-command, -r prints the digest output in coreutils format, and -sha512 selects the SHA512 digest.

Per validare con il checksum Whirlpool:

root #openssl dgst -r -whirlpool stage3-sparc-<release>.tar.bz2

Confrontare il risultato di questi comandi con il valore registrato nei file .DIGESTS(.asc). I valori devono corrispondere, altrimenti il file scaricato potrebbe essere corrotto (oppure è corrotto il file digests).

Un altro modo è usare il comando sha512sum:

root #sha512sum stage3-sparc-<release>.tar.bz2

The --check option instructs sha256sum to read a list of expected files and associated hashes, and then print an associated "OK" for each file that calculates correctly or a "FAILED" for files that do not.

Così come per il file ISO, è possibile verificare anche la firma crittografica del file .DIGESTS.asc usando gpg per essere sicuri che le somme di controllo non siano state manomesse:

For official Gentoo live images, the sec-keys/openpgp-keys-gentoo-release package provides PGP signing keys for automated releases. The keys must first be imported into the user's session in order to be used for verification:

root #gpg --import /usr/share/openpgp-keys/gentoo-release.asc

For all non-official live images which offer gpg and wget in the live environment, a bundle containing Gentoo keys can be fetched and imported:

root #wget -O - https://qa-reports.gentoo.org/output/service-keys.gpg | gpg --import

Verify the signature of the tarball and, optionally, associated checksum files:

root #gpg --verify stage3-sparc-<release>.tar.bz2.DIGESTS.asc

If verification succeeds, "Good signature from" will be in the output of the previous command(s).

The fingerprints of the OpenPGP keys used for signing release media can be found on the release media signatures page.

Installare uno stage tarball

Ora scompattare lo stage scaricato nel sistema. Useremo tar per procedere:

root #tar xvjpf stage3-*.tar.bz2 --xattrs --numeric-owner

Assicurarsi di usare le stesse opzioni (xvjpf e --xattrs). La x sta per Estrai, la v sta per Verboso per vedere cosa succede durante il processo di estrazione (opzionale), la j sta per Decomprimi con bzip2, la p sta per Preserva i permessi e la f indica che si vuole estrarre un File, l'input non è standard. --xattrs serve per includere gli attributi estesi memorizzati nell'archivio. Infine, --numeric-owner viene usato per assicurarsi che gli ID di utenti e gruppi dei file estratti dal tarball rimangano uguali a quelli pensati dalla squadra ingegneristica dei rilasci di Gentoo, anche per gli utenti avventurosi che non stanno usando mezzi di installazione ufficiali di Gentoo.

  • x extract, instructs tar to extract the contents of the archive.
  • p preserve permissions.
  • v verbose output.
  • f file, provides tar with the name of the input archive.
  • --xattrs-include='*.*' Preserves extended attributes in all namespaces stored in the archive.
  • --numeric-owner Ensure that the user and group IDs of files being extracted from the tarball remain the same as Gentoo's release engineering team intended (even if adventurous users are not using official Gentoo live environments for the installation process).

Una volta che il file stage è stato installato, si continui con la Configurazione delle opzioni di compilazione.

Configurazione delle opzioni di compilazione

Introduzione

Per ottimizzare Gentoo, è possibile impostare un paio di variabili che influenzeranno il comportamento di Portage, il gestore di pacchetti di Gentoo ufficialmente supportato. Tutte quelle variabili possono essere impostate come variabili d'ambiente (usando export) però l'effetto non sarà permanente. Per conservare le impostazioni, Portage legge nel file /etc/portage/make.conf, un file di configurazione di Portage.

Nota
Technically variables can be exported via the shell's profile or rc files, however that is not best practice for basic system administration.

Portage reads in the make.conf file when it runs, which will change runtime behavior depending on the values saved in the file. make.conf can be considered the primary configuration file for Portage, so treat its content carefully.

Nota
Si può trovare un elenco commentato di tutte le variabili possibili nel file /mnt/gentoo/usr/share/portage/config/make.conf.example. Per completare un'installazione, è necessario impostare solo le variabili menzionate di seguito.

For a successful Gentoo installation only the variables that are mentioned below need to be set.}}

Si apra un editor (in questa guida useremo nano) per modificare le variabili di ottimizzazione che discuteremo in seguito.

root #nano -w /mnt/gentoo/etc/portage/make.conf

Dal file make.conf.example si comprende come questo debba essere strutturato: le linee commentate iniziano con "#", le altre linee definiscono le variabili usando la sintassi VARIABILE="contenuto". Molte di queste variabili sono discusse in seguito.

CFLAGS e CXXFLAGS

Le variabili CFLAGS e CXXFLAGS definiscono rispettivamente le opzioni di ottimizzazioni per i compilatori GCC C e C++. Benché siano definite in maniera generale qui, per ottenere le migliori prestazioni si dovrebbero ottimizzare quelle opzioni separatamente per ogni programma. Dato che ciascun programma è diverso. Tuttavia, ciò non è gestibile, per cui si utilizza la definizione di queste variabili (flag) nel file make.conf.

Nel file make.conf si dovrebbero definire le opzioni di ottimizzazione che renderanno il sistema indicativamente più performante possibile. Non si usino impostazioni sperimentali in questa variabile; troppe ottimizzazioni possono addirittura peggiorare il comportamento dei programmi (blocchi, o anche peggio, malfunzionamenti).

Non spiegheremo tutte le opzioni di ottimizzazione possibili. Per comprenderle tutte, si legga il Manuale GNU Online o la pagina di informazioni di gcc (info gcc - funziona solo su sistemi Linux in esecuzione). Il file make.conf.example stesso contiene tantissimi esempi ed informazioni; non si dimentichi di leggerlo.

Una prima impostazione è l'opzione -march= o -mtune=, che specifica il nome dell'architettura di destinazione. Nel file make.conf.example sono descritte le possibili opzioni (attraverso commenti). Un valore comunemente usato è native che indica al compilatore di usare come architettura di destinazione quella del sistema in uso (quella su cui gli utenti stanno installando Gentoo).

Un'altra opzione è -O (O maiuscola, non zero), che specifica la classe di ottimizzazione di gcc. Possibili classi sono s (per ottimizzare le dimensioni), 0 (zero - per non ottimizzare affatto), 1, 2 o persino 3 per ottimizzare la velocità (ogni classe ha le stesse opzioni della precedente, più alcune aggiuntive). -O2 è l'opzione predefinita raccomandata. È noto che -O3 causa problemi se usata per l'intero sistema, quindi raccomandiamo di attenersi a -O2.

Un'altra opzione di ottimizzazione popolare è -pipe (usa le pipe - passaggio dati - invece di file temporanei per la comunicazione durante i vari passi della compilazione). Non ha alcun impatto sul codice generato, ma usa più memoria. Su sistemi con poca memoria, gcc potrebbe essere interrotto. In tal caso, non si usi questa opzione.

Usare -fomit-frame-pointer (che non conserva il frame pointer nel registro per le funzioni che non se ne servono) potrebbe avere serie ripercussioni sul debug delle applicazioni.

Quando vengono definite le variabili CFLAGS e CXXFLAGS, si combinino le varie opzioni di ottimizzazione in un'unica stringa. I valori predefiniti contenuti nell'archivio stage3 scompattato dovrebbero essere abbastanza buoni. Quello di seguito è solo un esempio:

CODE Esempi delle variabili CFLAGS e CXXFLAGS
CFLAGS="-O2 -mcpu=ultrasparc -pipe"
# Usare le stesse impostazioni per ambo le variabili
CXXFLAGS="${CFLAGS}"
Suggerimento
Benché l'articolo relativo all'ottimizzazione GCC abbia più informazioni su come le varie opzioni di compilazione possano influenzare un sistema, l'articolo CFLAGS sicure dovrebbe essere un posto più pratico per i principianti per iniziare ad ottimizzare i loro sistemi.

MAKEOPTS

La variabile MAKEOPTS definisce quante compilazioni parallele dovrebbero avvenire quando si installa un pacchetto. Una buona scelta è il numero di CPU (o core di CPU) nel sistema più uno, ma questa linea guida non è sempre perfetta.

Further, as of Portage 3.0.53[1], if left undefined, Portage's default behavior is to set the MAKEOPTS load-average value to the same number of threads returned by nproc.

A good choice is the smaller of: the number of threads the CPU has, or the total amount of system RAM divided by 2 GiB.

Attenzione
Using a large number of jobs can significantly impact memory consumption. A good recommendation is to have at least 2 GiB of RAM for every job specified (so, e.g. -j6 requires at least 12 GiB). To avoid running out of memory, lower the number of jobs to fit the available memory.
Suggerimento
When using parallel emerges (--jobs), the effective number of jobs run can grow exponentially (up to make jobs multiplied by emerge jobs). This can be worked around by running a localhost-only distcc configuration that will limit the number of compiler instances per host.
CODE Esempio di dichiarazione di MAKEOPTS nel file make.conf
MAKEOPTS="-j2"

Search for MAKEOPTS in man 5 make.conf for more details.

Pronti, attenti, via!

Aggiornare il file /mnt/gentoo/etc/portage/make.conf in base alle preferenze personali e salvarlo (gli utenti di nano devono usare Ctrl+X).




Effettuare chroot

Copiare le informazioni del DNS

Rimane da fare ancora una cosa prima di entrare nel nuovo ambiente, ovvero copiare le informazioni del DNS nel file /etc/resolv.conf. Ciò va fatto per assicurarsi che la rete funzioni anche dopo essere entrati nel nuovo ambiente. /etc/resolv.conf contiene i name server per la rete.

Per copiare queste informazioni, si raccomanda di passare l'opzione --dereference al comando cp. Ciò garantisce che, se /etc/resolv.conf è un collegamento simbolico, venga copiato il file indicato dal collegamento invece del collegamento simbolico stesso. Altrimenti, nel nuovo ambiente, il collegamento simbolico punterebbe ad un file non esistente (in quanto ciò che ora indica il collegamento non sarà disponibile nel nuovo ambiente).

root #cp --dereference /etc/resolv.conf /mnt/gentoo/etc/

Montaggio dei fileystem necessari

A breve, la radice (root) di Linux sarà cambiata con quella della nuova ubicazione. Per essere sicuri che il nuovo ambiente funzioni correttamente, alcuni filesystem devono essere disponibili fin d'ora.

I filesystem da rendere disponibili sono:

  • /proc/ che è uno pseudo filesystem (appare come fossero file ordinari, ma in realtà è generato in tempo reale) tramite il quale il kernel Linux mostra informazioni a tutto l'ambiente
  • /sys/ che è uno pseudo filesystem, come /proc/ che una volta si pensava l'avrebbe sostituito, ed è più strutturato di /proc/
  • /dev/ è un filesystem normale, parzialmente gestito dal gestore dei dispositivi di Linux (solitamente udev), il quale contiene un file per ciascun dispositivo
  • /run/ è un filesystem temporaneo utilizzato per i file generati in fase di esecuzione, come i file PID o il locks

Il percorso /proc/ sarà montato su /mnt/gentoo/proc/ mentre gli altri saranno montati congiuntamente. Ciò significa che, ad esempio, /mnt/gentoo/sys/ sarà effettivamente /sys/ (è solo un secondo punto di accesso allo stesso filesystem) mentre /mnt/gentoo/proc/ è un nuovo montaggio (un'istanza per così dire) del filesystem.

Suggerimento
If using Gentoo's install media, this step can be replaced with simply: arch-chroot /mnt/gentoo.
root #mount --types proc /proc /mnt/gentoo/proc
root #mount --rbind /sys /mnt/gentoo/sys
root #mount --make-rslave /mnt/gentoo/sys
root #mount --rbind /dev /mnt/gentoo/dev
root #mount --make-rslave /mnt/gentoo/dev
root #mount --bind /run /mnt/gentoo/run
root #mount --make-slave /mnt/gentoo/run
Nota
Le operazioni --make-rslave sono necessarie per il supporto di systemd più avanti nell'installazione.
Attenzione
Quando si usano mezzi di installazione non-Gentoo, quanto detto potrebbe risultare insufficiente. Alcune distribuzioni creano un link simbolico di /dev/shm su /run/shm/ che, dopo chroot, risulta non valido. Facendo un corretto montaggio tmpfs di /dev/shm/ può risolvere questo problema:
root #test -L /dev/shm && rm /dev/shm && mkdir /dev/shm
root #mount --types tmpfs --options nosuid,nodev,noexec shm /dev/shm

Ci si assicuri anche che la modalità 1777 sia impostata:

root # chmod 1777 /dev/shm /run/shm

Entrare nel nuovo ambiente

Ora che tutte le partizioni sono state inizializzate e l'ambiente base installato, è tempo di entrare nel nuovo ambiente attraverso chroot. Ciò significa che la sessione cambierà la sua radice (la posizione di livello più alto alla quale si può fare accesso) da quella dell'attuale ambiente di installazione (del CD o di un altro mezzo di installazione) a quella del sistema installato (ovvero le partizioni inizializzate). Da cui il nome, change root (cambiare radice) o chroot.

Questo cambio di radice può esser fatto in tre passaggi:

  1. La posizione radice (root) è modificata da / (sul mezzo di installazione) a /mnt/gentoo/ sulle partizioni usando chroot
  2. Alcune impostazioni (quelle su /etc/profile) sono caricate nella memoria usando il comando source
  3. L'attesa comandi (prompt) primaria è modificata per ricordarci che questa sessione avviene in un ambiente chroot
root #chroot /mnt/gentoo /bin/bash
root #source /etc/profile
root #export PS1="(chroot) ${PS1}"

Da questo momento, tutte le azioni sono direttamente eseguite nel nuovo ambiente Gentoo Linux. Certamente si è ancora lontani dalla conclusione, per questo motivo l'installazione ha ancora alcune sezioni!

Suggerimento
Se l'installazione di Gentoo viene interrotta in qualsiasi momento da questo punto, dovrebbe essere possibile riprenderla a partire da questo passaggio. Non c'è necessità di ripartizionare il disco nuovamente! Montare la partizione radice ed eseguire i passi qui sopra iniziando con la copia delle informazioni DNS per rientrare nell'ambiente funzionante. Questo è utile anche per correggere alcuni problemi con i bootloader (selettori di avvio). Ulteriori informazioni si possono trovare nell'articolo chroot.

Preparing for a bootloader

Now that the new environment has been entered, it is necessary to prepare the new environment for the bootloader. It will be important to have the correct partition mounted when it is time to install the bootloader.

UEFI systems

For UEFI systems, was formatted with the FAT32 filesystem and will be used as the EFI System Partition (ESP). Create a new directory (if not yet created), and then mount ESP there:

root #mkdir # May have been created in a previous step
root #mount

DOS/Legacy BIOS systems

For DOS/Legacy BIOS systems, the bootloader will be installed into the directory, therefore mount as follows:

root #mount

Configurare Portage

Repositorio ebuild di Gentoo

Un altro importante passo durante la selezione dei mirror è la configurazione dei repositori delle ebuild di Gentoo tramite il file /etc/portage/repos.conf/gentoo.conf. Questo file contiene le informazioni di sincronizzazione necessarie per aggiornare il repositorio dei pacchetti (la raccolta di ebuild e di file correlati contenenti tutte le informazioni di cui Portage ha bisogno per scaricare ed installare i pacchetti software).

La configurazione del repositorio può essere fatta in pochi semplici passi. Prima, se non esiste, creare il percorso repos.conf:

root #mkdir --parents /mnt/gentoo/etc/portage/repos.conf

Successivamente, copiare il file di configurazione dei repositori di Gentoo, fornito da Portage, nella cartella (appena creata) repos.conf:

root #cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf

Si dia un'occhiata con un editor di testo o utilizzando il comando cat. Il contenuto del file dovrebbe essere in formato .ini e somigliare a questo:

FILE /mnt/gentoo/etc/portage/repos.conf/gentoo.conf
[DEFAULT]
main-repo = gentoo
 
[gentoo]
location = /var/db/repos/gentoo
sync-type = rsync
sync-uri = rsync://rsync.gentoo.org/gentoo-portage
auto-sync = yes
sync-rsync-verify-jobs = 1
sync-rsync-verify-metamanifest = yes
sync-rsync-verify-max-age = 24
sync-openpgp-key-path = /usr/share/openpgp-keys/gentoo-release.asc
sync-openpgp-key-refresh-retry-count = 40
sync-openpgp-key-refresh-retry-overall-timeout = 1200
sync-openpgp-key-refresh-retry-delay-exp-base = 2
sync-openpgp-key-refresh-retry-delay-max = 60
sync-openpgp-key-refresh-retry-delay-mult = 4

Il valore predefinito della variabile sync-uri sopra elencato comporta un posizionamento dei mirror basato sulla rotazione. Ciò ottimizzerà il carico sulla banda dell'infrastruttura di Gentoo e fornirà una soluzione di ripiego in caso uno specifico mirror risulti non in linea. Si raccomanda di mantenere l'URI predefinito a meno che non venga usato un mirror di Portage locale e privato.

Suggerimento
Per coloro che sono interessati, le specifiche ufficiali per le API di sincronizzazione del plug-in di Portage possono essere consultate nell' Articolo sulla sincronizzazione del progetto Portage.

Installare un'istantanea del repository ebuild Gentoo dal web

Il prossimo passo consiste nell'installare un'istantanea del repository ebuild di Gentoo. Questa istantanea contiene una collezione di file che informano Portage riguardo i titoli di software disponibili (per l'installazione), quali profili può selezionare l'amministratore del sistema, elementi notizia specifici su pacchetti o profili, ecc.

L'uso di emerge-webrsync è raccomandato per chi si trova dietro un firewall restrittivo (usa i protocolli HTTP/FTP per scaricare l'istantanea) e vuole risparmiare la banda. I lettori che non hanno restrizioni di rete o di banda possono felicemente saltare fino alla fine di questa sezione.

Questo preleverà l'ultima istantanea (la quale è rilasciata giorno per giorno) da uno dei distributori (mirror) di Gentoo e la installerà nel sistema:

root #emerge-webrsync
Nota
Durante questa operazione, emerge-webrsync potrebbe lamentarsi riguardo una posizione /var/db/repos/gentoo mancante. Questo deve essere atteso e non destare preoccupazioni - lo strumento creerà la posizione.

Da questo momento in avanti, Portage potrebbe menzionare che certi aggiornamenti è raccomandato eseguirli. Ciò avviene perché i pacchetti di sistema installati attraverso il file stage potrebbero avere disponibili delle versioni più recenti; Portage è ora a conoscenza dei nuovi pacchetti grazie all'istantanea del repositorio. Gli aggiornamenti dei pacchetti possono essere ignorati in sicurezza per ora; gli aggiornamenti possono essere posticipati dopo la conclusione dell'installazione di Gentoo.


Opzionale: Selezionare i mirror

Per scaricare rapidamente il codice sorgente si raccomanda di selezionare un mirror (distributore) veloce. Portage cercherà la variabile GENTOO_MIRRORS nel file make.conf ed utilizzerà i mirror lì elencati. È possibile navigare nella lista dei mirror di Gentoo e cercare un mirror (o più mirror) vicino alla posizione geografica del sistema (in quanto quelli risulteranno solitamente più veloci). Tuttavia, forniamo anche uno strumento utile chiamato mirrorselect che fornisce agli utenti una comoda interfaccia per selezionare i mirror necessari. Basta semplicemente navigare sui mirror prescelti e premere Spazio per selezionare uno o più mirror.

A tool called mirrorselect provides a pretty text interface to more quickly query and select suitable mirrors. Just navigate to the mirrors of choice and press Spacebar to select one or more mirrors.

root #mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf

Alternatively, a list of active mirrors are available online.

Opzionale: Aggiornare il repositorio ebuild di Gentoo

È possibile aggiornare il repositorio ebuild di Gentoo all'ultima versione. Il precedente comando emerge-webrsync avrà installato un'istantanea decisamente recente (solitamente delle ultime 24 ore) dunque questo passo è decisamente facoltativo.

Supponiamo siano necessari gli aggiornamenti degli ultimissimi pacchetti (fino ad 1 ora), dunque si usi emerge --sync. Questo comando userà il protocollo rsync per aggiornare al repositorio ebuild di Gentoo (il quale è stato prelevato prima attraverso emerge-webrsync) al più recente stato.

root #emerge --sync

Sui terminali lenti, come alcuni framebuffer o console seriali, è raccomandato usare l'opzione --quiet per velocizzare il processo:

root #emerge --sync --quiet

Leggere gli elementi notizia

Quando il repositorio ebuild di Gentoo viene sincronizzato, Portage potrebbe scrivere messaggi informativi simili a questo:

* IMPORTANT: 2 news items need reading for repository 'gentoo'.
* Use eselect news to read news items.

Gli elementi notizia sono stati creati per fornire un mezzo di comunicazione affinché i messaggi critici siano notificati agli utenti attraverso il repository ebuild Gentoo. Per gestirli, usare eselect news. L'applicazione eselect è un'utilità di Gentoo che fornisce un'interfaccia di gestione comune per l'amministrazione di sistema. In questo caso, eselect è richiesto per usare il modulo news.

Per il modulo news, tre operazioni sono le più comuni:

  • Con list viene mostrata una panoramica degli elementi notizia disponibili.
  • Con read possono essere letti gli elementi notizia.
  • Con purge possono essere rimossi gli elementi notizia una volta che siano stati letti e non si potranno più rileggere.
root #eselect news list
root #eselect news read

Ulteriori informazioni sul lettore delle notizie sono presenti sulla sua pagina manuale:

root #man news.eselect

Scegliere il profilo corretto

Suggerimento
Desktop profiles are not exclusively for desktop environments. They are also suitable for minimal window managers like i3 or sway.

Un profilo è un elemento costitutivo per un qualsiasi sistema Gentoo. Non solo specifica valori predefiniti per USE, CFLAGS, ed altre importanti variabili, ma blocca il sistema su un certo intervallo di versione di pacchetti. Queste impostazioni sono tutte mantenute dagli sviluppatori Portage di Gentoo.

Per vedere quale profilo sta attualmente usando il sistema, esegui eselect usando il modulo profile:

root #eselect profile list
Available profile symlink targets:
  [1]   default/linux/sparc/ *
  [2]   default/linux/sparc//desktop
  [3]   default/linux/sparc//desktop/gnome
  [4]   default/linux/sparc//desktop/kde
Nota
La risposta del comando è giusto un esempio e cambia con il tempo.
Nota
Quando si usa systemd, assicurarsi che il nome del profilo contenga systemd. Altrimenti, assicurati che il nome del profilo non contenga systemd.

Come si può vedere, ci sono anche sotto profili per i desktop disponibili per alcune architetture.

Attenzione
Gli aggiornamenti del profilo non devono essere presi alla leggera. Quando si seleziona il profilo iniziale, assicurarsi di utilizzare il profilo corrispondente a la stessa versione come quello inizialmente utilizzato da stage3 (es. ). Ogni nuova versione del profilo viene annunciata attraverso una news contenente le istruzioni di migrazione. Assicurati di leggerlo e seguirlo prima di passare a un nuovo profilo.

Dopo aver visto i profili disponibili per l'architettura sparc, gli utenti possono selezionare un profilo diverso per il sistema:

root #eselect profile set 2



Nota
Il sotto profilo developer è dedicato ad uno sviluppatore Gentoo Linux e non va considerato come una scelta per l'utente qualsiasi.

Optional: Adding a binary package host

Since December 2023, Gentoo's Release Engineering team has offered an official binary package host (colloquially shorted to just "binhost") for use by the general community to retrieve and install binary packages (binpkgs).[1]

Adding a binary package host allows Portage to install cryptographically signed, compiled packages. In many cases, adding a binary package host will greatly decrease the mean time to package installation and adds much benefit when running Gentoo on older, slower, or low power systems.

Repository configuration

The repository configuration for a binhost is found in Portage's /etc/portage/binrepos.conf/ directory, which functions similarly to the configuration mentioned in the Gentoo ebuild repository section.

When defining a binary host, there are two important aspects to consider:

  1. The architecture and profile targets within the sync-uri value do matter and should align to the respective computer architecture (sparc in this case) and system profile selected in the Choosing the right profile section.
  2. Selecting a fast, geographically close mirror will generally shorten retrieval time. Review the mirrorselect tool mentioned in the Optional: Selecting mirrors section or review the online list of mirrors where URL values can be discovered.

FILE /etc/portage/binrepos.conf/gentoo.confCDN-based binary package host example
[binhost]
priority = 9999
sync-uri = https://distfiles.gentoo.org/releases/<arch>/binpackages/<profile>/x86-64/

Installing binary packages

Portage will compile packages from code source by default. It can be instructed to use binary packages in the following ways:

  1. The --getbinpkg option can be passed when invoking the emerge command. This method of for binary package installation is useful to install only a particular binary package.
  2. Changing the system's default via Portage's FEATURES variable, which is exposed through the /etc/portage/make.conf file. Applying this configuration change will cause Portage to query the binary package host for the package(s) to be requested and fall back to compiling locally when no results are found.

For example, to have Portage always install available binary packages:

FILE /etc/portage/make.confConfigure Portage to use binary packages by default
# Appending getbinpkg to the list of values within the FEATURES variable
FEATURES="${FEATURES} getbinpkg"
# Require signatures
FEATURES="${FEATURES} binpkg-request-signature"

Additional Portage features will be discussed in the the next chapter of the handbook.

Configurare la variabile USE

La variabile USE è una delle più potenti che Gentoo offre ai suoi utenti. Numerosi programmi possono essere compilati con o senza il supporto facoltativo di certi elementi. Per esempio, alcuni programmi possono essere compilati con il supporto a GTK+ o con il supporto a Qt. Altri possono essere compilati con o senza il supporto SSL. Alcuni programmi possono essere persino compilati con il supporto al framebuffer (svgalib) anziché il supporto a X11 (X-server).

La maggior parte delle distribuzioni compila i pacchetti con il supporto per più cose possibili, aumentando la dimensione dei programmi ed i tempi di avvio, per non menzionare l'enorme quantità di dipendenze. Con Gentoo gli utenti possono definire con quali opzioni un pacchetto dovrebbe essere compilato. Qui entra in gioco USE.

Nella variabile USE gli utenti definiscono le parole chiave che saranno mappate come opzioni di compilazione. Per esempio, ssl compilerà con il supporto SSL nei programmi che lo supportano. -X rimuoverà il supporto al server X (notare il meno di fronte al simbolo). gnome gtk -kde -qt5 compilerà i programmi con il supporto GNOME (e GTK+) e non con il supporto KDE (e Qt), rendendo il sistema interamente modificato per GNOME (se l'architettura lo supporta).

Le impostazioni predefinite per USE si trovano nei file make.defaults del profilo Gentoo usato per il sistema. Gentoo usa un (complesso) sistema di eredità per i suoi profili, nel quale non scaveremo a fondo in questo stadio. Il modo più facile per controllare le attuali impostazioni attive per USE è eseguire emerge --info e selezionare la linea che inizia con USE:

root #emerge --info | grep ^USE
USE="X acl alsa amd64 berkdb bindist bzip2 cli cracklib crypt cxx dri ..."
Nota
L'esempio soprastante è stato troncato, l'elenco effettivo dei valori di USE è molto, molto più grande.

Una descrizione completa sulle opzioni disponibili per USE può essere trovata nel sistema su /var/db/repos/gentoo/profiles/use.desc.

root #less /var/db/repos/gentoo/profiles/use.desc

Dentro il comando less, si può scorrere il testo usando i tasti e , ed uscire premendo q.

Come esempio mostriamo un'impostazione di USE per un sistema basato su KDE con supporto DVD, ALSA e scrittura CD:

root #nano -w /etc/portage/make.conf
FILE /etc/portage/make.confAbilitare i flag per un sistema basato su KDE/Plasma con supporto per la registrazione di DVD, ALSA e CD
USE="-gtk -gnome qt5 kde dvd alsa cdr"

Quando USE viene definita in /etc/portage/make.conf essa aggiunge (o rimuove se l'opzione USE inizia con il segno -) opzioni dall'elenco predefinito. Gli utenti che vogliono ignorare qualsiasi impostazione predefinita di USE e gestirla completamente da soli devono far cominciare la definizione di USE in make.conf con -*:

FILE /etc/portage/make.confIgnorando le opzioni predefinite di USE
USE="-X acl alsa"
Attenzione
Sebbene sia possibile, l'opzione -* (vista nell'esempio precedente) è sconsigliata poiché le impostazioni predefinite accuratamente scelte per USE possono essere configurate in alcuni ebuild per prevenire conflitti ed altri errori.

CPU_FLAGS_*

Some architectures (including AMD64/X86, ARM, PPC) have a USE_EXPAND variable called CPU_FLAGS_<ARCH>, where <ARCH> is replaced with the relevant system architecture name.

Importante
Do not be confused! AMD64 and X86 systems share some common architecture, so the proper variable name for AMD64 systems is CPU_FLAGS_X86.

This is used to configure the build to compile in specific assembly code or other intrinsics, usually hand-written or otherwise extra, and is not the same as asking the compiler to output optimized code for a certain CPU feature (e.g. -march=).

Users should set this variable in addition to configuring their COMMON_FLAGS as desired.

A few steps are needed to set this up:

root #emerge --ask app-portage/cpuid2cpuflags

Inspect the output manually if curious:

root #cpuid2cpuflags

Then copy the output into package.use:

root #echo "*/* $(cpuid2cpuflags)" > /etc/portage/package.use/00cpu-flags

VIDEO_CARDS

The VIDEO_CARDS USE_EXPAND variable should be configured appropriately depending on the available GPU(s). Setting VIDEO_CARDS is not required for a console only install.

Below is an example of a properly set VIDEO_CARDS variable. Substitute the name of the driver(s) to be used.

FILE /etc/portage/make.conf
VIDEO_CARDS="amdgpu radeonsi"

Details for various GPU(s) can be found at the AMDGPU, Intel, Nouveau (Open Source), or NVIDIA (Proprietary) articles.

Opzionale: Configurare la variabile ACCEPT_LICENSE

Starting with Gentoo Linux Enhancement Proposal 23 (GLEP 23), a mechanism was created to allow system administrators the ability to "regulate the software they install with regards to licenses... Some want a system free of any software that is not OSI-approved; others are simply curious as to what licenses they are implicitly accepting."[2] With a motivation to have more granular control over the type of software running on a Gentoo system, the ACCEPT_LICENSE variable was born.

Gentoo viene fornito con un valore predefinito nei profili, ad esempio:

user $portageq envvar ACCEPT_LICENSE
@FREE

For the convenience of system administration, legally-similar software licenses have been bundled together - each according to its like-kind. License group definitions are available for viewing and are managed by the Gentoo Licenses project. While an individual license is not, license groups are syntactically preceded with an @ symbol, enabling them to be easily distinguished in the ACCEPT_LICENSE variable.

Some common license groups include:

A list of software licenses grouped according to their kinds.
Name Description
@GPL-COMPATIBLE GPL compatible licenses approved by the Free Software Foundation [a_license 1]
@FSF-APPROVED Free software licenses approved by the FSF (includes @GPL-COMPATIBLE)
@OSI-APPROVED Licenses approved by the Open Source Initiative [a_license 2]
@MISC-FREE Misc licenses that are probably free software, i.e. follow the Free Software Definition [a_license 3] but are not approved by either FSF or OSI
@FREE-SOFTWARE Combines @FSF-APPROVED, @OSI-APPROVED, and @MISC-FREE.
@FSF-APPROVED-OTHER FSF-approved licenses for "free documentation" and "works of practical use besides software and documentation" (including fonts)
@MISC-FREE-DOCS Misc licenses for free documents and other works (including fonts) that follow the free definition [a_license 4] but are NOT listed in @FSF-APPROVED-OTHER.
@FREE-DOCUMENTS Combines @FSF-APPROVED-OTHER and @MISC-FREE-DOCS.
@FREE Metaset of all licenses with the freedom to use, share, modify and share modifications. Combines @FREE-SOFTWARE and @FREE-DOCUMENTS.
@BINARY-REDISTRIBUTABLE Licenses that at least permit free redistribution of the software in binary form. Includes @FREE.
@EULA License agreements that try to take away your rights. These are more restrictive than "all-rights-reserved" or require explicit approval

Currently set system wide acceptable license values can be viewed via:

user $portageq envvar ACCEPT_LICENSE
@FREE

As visible in the output, the default value is to only allow software which has been grouped into the @FREE category to be installed.

Specific licenses or licenses groups for a system can be defined in the following locations:

  • System wide within the selected profile - this sets the default value.
  • System wide within the /etc/portage/make.conf file. System administrators override the profile's default value within this file.
  • Per-package within a /etc/portage/package.license file.
  • Per-package within a /etc/portage/package.license/ directory of files.

The system wide license default in the profile is overridden within the /etc/portage/make.conf:

FILE /etc/portage/make.confAccept licenses with ACCEPT_LICENSE system wide
# Overrides the profile's ACCEPT_LICENSE default value
ACCEPT_LICENSE="-* @FREE @BINARY-REDISTRIBUTABLE"

Optionally system administrators can also define accepted licenses per-package as shown in the following directory of files example. Note that the package.license directory will need created if it does not already exist:

root #mkdir /etc/portage/package.license

Software license details for an individual Gentoo package are stored within the LICENSE variable of the associated ebuild. One package may have one or many software licenses, therefore it be necessary to specify multiple acceptable licenses for a single package.

FILE /etc/portage/package.license/kernelAccepting licenses on a per-package basis
app-arch/unrar unRAR
sys-kernel/linux-firmware @BINARY-REDISTRIBUTABLE
sys-firmware/intel-microcode intel-ucode
Importante
The LICENSE variable in an ebuild is only a guideline for Gentoo developers and users. It is not a legal statement, and there is no guarantee that it will reflect reality. It is recommended to not solely rely on a ebuild developer's interpretation of a software package's license; but check the package itself in depth, including all files that have been installed to the system.

Aggiornare il @world set

Il seguente passo è necessario per fa sì che il sistema possa applicare aggiornamenti o cambiamenti alle flag USE apparsi dopo la costruzione dello stage3 e da qualsiasi selezione di profilo:

  1. A profile target different from the stage file has been selected.
  2. Additional USE flags have been set for installed packages.

Readers who are performing an 'install Gentoo speed run' may safely skip @world set updates until after their system has rebooted into the new Gentoo environment.

Readers who are performing a slow run can have Portage perform updates for package, profile, and/or USE flag changes at the present time:

root #emerge --ask --verbose --update --deep --newuse @world

Removing obsolete packages

It is important to always depclean after system upgrades to remove obsolete packages. Review the output carefully with emerge --depclean --pretend to see if any of the to-be-cleaned packages should be kept if personally using them. To keep a package which would otherwise be depcleaned, use emerge --noreplace foo.

root #emerge --ask --pretend --depclean

If happy, then proceed with a real depclean:

root #emerge --ask --depclean
Suggerimento
Se è stato selezionato un profilo con un ambiente desktop completo, il processo potrebbe aumentare notevolmente la quantità di tempo necessaria per il processo di installazione. Coloro che hanno un tempo ristretto possono lavorare seguendo questa 'regola pratica': più corto è il nome del profilo, meno specifico sarà il @world set del sistema; meno specifico sarà il @world set del sistema, meno pacchetti saranno richiesti dal sistema. In altre parole:
  • Selezionare default/linux/amd64/ comporterà l'aggiornamento di veramente pochi pacchetti, mentre
  • Selezionare default/linux/amd64//desktop/gnome/systemd richiederà molti pacchetti da installare, dato che il sistema di init sta cambiando da OpenRC a systemd, e le librerie dell'ambiente desktop GNOME saranno installate.


Ora locale

Nota
This step does not apply to users of the musl libc. Users who do not know what that means should perform this step.

Si evitino le ore locali /usr/share/zoneinfo/Etc/GMT* poiché i loro nomi non indicano le aree attese. Per esempio, GMT-8 è di fatto GMT+8.

Scegliere l'ora locale per il sistema. Cercare le ore locali disponibili su /usr/share/zoneinfo/:

root #ls /usr/share/zoneinfo
root #ls -l /usr/share/zoneinfo/Europe/
total 256
-rw-r--r-- 1 root root 2933 Dec  3 17:19 Amsterdam
-rw-r--r-- 1 root root 1742 Dec  3 17:19 Andorra
-rw-r--r-- 1 root root 1151 Dec  3 17:19 Astrakhan
-rw-r--r-- 1 root root 2262 Dec  3 17:19 Athens
-rw-r--r-- 1 root root 3664 Dec  3 17:19 Belfast
-rw-r--r-- 1 root root 1920 Dec  3 17:19 Belgrade
-rw-r--r-- 1 root root 2298 Dec  3 17:19 Berlin
-rw-r--r-- 1 root root 2301 Dec  3 17:19 Bratislava
-rw-r--r-- 1 root root 2933 Dec  3 17:19 Brussels
...

Supponiamo che la timezone scelta sia Europe/Brussels.

OpenRC

Scriviamo il nome della timezone nel file /etc/timezone.

root #echo "Europe/Brussels" > /etc/timezone

Poi, riconfigurare il pacchetto sys-libs/timezone-data, il quale aggiornerà il file /etc/localtime per noi, basato sugli inserimenti di /etc/timezone. Il file /etc/localtime è usato dalla libreria C del sistema per conoscere in quale ora locale il sistema si trova.

root #emerge --config sys-libs/timezone-data
Nota
The /etc/localtime file is used by the system C library to know the timezone the system is in.

systemd

Quando si usa systemd si utilizza un approccio leggermente diverso. Viene generato un collegamento simbolico:

root #ln -sf ../usr/share/zoneinfo/Europe/Brussels /etc/localtime

Successivamente, quando systemd è in esecuzione, il fuso orario e le relative impostazioni possono essere configurate con il comando timedatectl.

Configurare le lingue

Nota
Questo passaggio non si applica agli utenti di musl libc. Gli utenti che non sanno cosa significa dovrebbero eseguire questo passaggio.

Generazione locale

La maggior parte degli utenti usa solo una o due lingue nel proprio sistema.

Le lingue non specificano solamente la lingua che l'utente userà per interagire con il proprio sistema, ma anche le regole per ordinare le stringhe, mostrare le date e gli orari, ecc. i locale sono case sensitive e devono essere rappresentati esattamente come descritti. Un lista completa di tutti i locale disponibili può essere trovata nel file /usr/share/i18n/SUPPORTED.

Le localizzazioni di sistema supportate devono essere definite nel file /etc/locale.gen.

root #nano -w /etc/locale.gen

Le lingue seguenti sono un esempio per avere sia l'inglese (Stati Uniti) sia il tedesco (Germania/Deutchland) con i formati di carattere corrispondenti (per esempio UTF-8).

FILE /etc/locale.genAbilitare le lingue US e DE con i formati dei caratteri appropriati
en_US ISO-8859-1
en_US.UTF-8 UTF-8
de_DE ISO-8859-1
de_DE.UTF-8 UTF-8
Attenzione
Raccomandiamo fortemente di aggiungere almeno una lingua UTF-8 poiché molte applicazioni possono richiederla per compilare correttamente.

Il passo successivo è eseguire il comando locale-gen. Questo comando genererà tutti i valori locali specificati nel file /etc/locale.gen.

root #locale-gen

Per verificare che i valori locali selezionati sono ora disponibili, eseguire locale -a.

On systemd installs, localectl can be used, e.g. localectl set-locale ... or localectl list-locales.

Selezione dei locale

Fatto ciò, si passa ad impostare le opzioni locali per tutto il sistema. Nuovamente si userà eselect, questa volta con il modulo locale.

Con eselect locale list vengono mostrate le opzioni disponibili:

root #eselect locale list
Available targets for the LANG variable:
  [1]  C
  [2]  C.utf8
  [3]  en_US
  [4]  en_US.iso88591
  [5]  en_US.utf8
  [6]  de_DE
  [7]  de_DE.iso88591
  [8]  de_DE.iso885915
  [9]  de_DE.utf8
  [10] POSIX
  [ ]  (free form)

Con eselect locale set <NUMBER>si può selezionare il locale corretto:

root #eselect locale set 9

Manualmente, ciò può essere fatto intervenendo sul file /etc/env.d/02locale e per Systemd il file /etc/locale.conf:

FILE /etc/env.d/02localeImpostare manualmente le definizioni dei valori locali del sistema
LANG="de_DE.UTF-8"
LC_COLLATE="C.UTF-8"

L'impostazione della localizzazione eviterà avvisi ed errori durante le compilazioni del kernel e del software più avanti nell'installazione.

Ora ricaricare l'ambiente:

root #env-update && source /etc/profile && export PS1="(chroot) ${PS1}"

Una completa Guida di localizazzione per fornire una guida aggiuntiva attraverso il processo di selezione locale. Un altro interessante articolo è la guida UTF-8 per informazioni molto specifiche su come abilitare UTF-8 nel sistema.




Opzionale: Installare il firmware

Firmware

Linux Firmware

Alcuni driver richiedono firmware addizionali da installare nel sistema affinché funzioni. Questo caso riguarda spesso le interfacce di rete, specialmente le interfacce di rete wireless. La maggior parte dei firmware si trovano su sys-kernel/linux-firmware:

It is recommended to have the sys-kernel/linux-firmware package installed before the initial system reboot in order to have the firmware available in the event that it is necessary:

root #emerge --ask sys-kernel/linux-firmware
Nota
Installing certain firmware packages often requires accepting the associated firmware licenses. If necessary, visit the license handling section of the Handbook for help on accepting licenses.

It is important to note that kernel symbols that are built as modules (M) will load their associated firmware files from the filesystem when they are loaded by the kernel. It is not necessary to include the device's firmware files into the kernel's binary image for symbols loaded as modules.

SOF Firmware

Importante
Use of this firmware requires enabling certain Kernel options and is only supported on AMD64 currently. Enabling these options are only necessary if a manual configuration is planned, as the Distribution Kernels have them enabled already. The necessary options are covered in architecture specific kernel configuration.

Sound Open Firmware (SOF) is a new open source audio driver meant to replace the proprietary Smart Sound Technology (SST) audio driver from Intel. 10th gen+ and Apollo Lake (Atom E3900, Celeron N3350, and Pentium N4200) Intel CPUs require this firmware for certain features and certain AMD APUs also have support for this firmware. SOF's supported platforms matrix can be found here for more information.

root #emerge --ask sys-firmware/sof-firmware

Microcode

In addition to discrete graphics hardware and network interfaces, CPUs also can require firmware updates. Typically this kind of firmware is referred to as microcode. Newer revisions of microcode are sometimes necessary to patch instability, security concerns, or other miscellaneous bugs in CPU hardware.

Microcode updates for AMD CPUs are distributed within the aforementioned sys-kernel/linux-firmware package. Microcode for Intel CPUs can be found within the sys-firmware/intel-microcode package, which will need to be installed separately. See the Microcode article for more information on how to apply microcode updates.

Kernel configuration and compilation

Adesso è ora di configurare e compilare i sorgenti del kernel. Ci sono due approcci per farlo:

Ranked from least involved to most involved:

  1. Il kernel sarà configurato e compilato manualmente.
  2. Un programma di nome genkernel sarà usato per compilare ed installare il kernel automaticamente.

Il nucleo su cui tutte le distribuzioni si basano è il kernel Linux, che fa da intermediario tra i programmi dell'utente ed il sistema fisico (hardware). Gentoo offre ai suoi utenti numerosi possibili sorgenti per il kernel. Una lista completa con descrizioni è disponibile alla pagina panoramica sui kernel.

Installare i sorgenti

Nota
This section is only relevant when using the following genkernel (hybrid) or manual kernel management approach.

When installing and compiling the kernel for sparc-based systems, Gentoo recommends the sys-kernel/gentoo-sources package.

Choose an appropriate kernel source and install it using emerge:

root #emerge --ask sys-kernel/gentoo-sources

Questo comando installerà i sorgenti del kernel Linux in /usr/src/ in cui un collegamento simbolico chiamato linux punterà ai sorgenti appena installati:

It is conventional for a /usr/src/linux symlink to be maintained, such that it refers to whichever sources correspond with the currently running kernel. However, this symbolic link will not be created by default. An easy way to create the symbolic link is to utilize eselect's kernel module.

For further information regarding the purpose of the symlink, and how to manage it, please refer to Kernel/Upgrade.

First, list all installed kernels:

root #eselect kernel list
Available kernel symlink targets:
  [1]   linux-3.16.5-gentoo

In order to create a symbolic link called linux, use:

root #eselect kernel set 1
root #ls -l /usr/src/linux
lrwxrwxrwx    1 root   root    12 Oct 13 11:04 /usr/src/linux -> linux-3.16.5-gentoo

Alternativa: Usare genkernel

Nota
In case it was missed, this section requires the kernel sources to be installed. Be sure to obtain the relevant kernel sources, then return here for the rest of section.

Se la configurazione manuale risulta troppo difficoltosa, allora è raccomandato usare genkernel. Esso configurerà e costruirà il kernel in modo automatico.

Genkernel provides a generic kernel configuration file and will compile the kernel and initramfs, then install the resulting binaries to the appropriate locations. This results in minimal and generic hardware support for the system's first boot, and allows for additional update control and customization of the kernel's configuration in the future.

Be informed: while using genkernel to maintain the kernel provides system administrators with more update control over the system's kernel, initramfs, and other options, it will require a time and effort commitment to perform future kernel updates as new sources are released. Those looking for a hands-off approach to kernel maintenance should use a distribution kernel.

For additional clarity, it is a misconception to believe genkernel automatically generates a custom kernel configuration for the hardware on which it is run; it uses a predetermined kernel configuration that supports most generic hardware and automatically handles the make commands necessary to assemble and install the kernel, the associate modules, and the initramfs file.

Binary redistributable software license group

If the linux-firmware package has been previously installed, then skip onward to the to the installation section.

As a prerequisite, due to the firwmare USE flag being enabled by default for the sys-kernel/genkernel package, the package manager will also attempt to pull in the sys-kernel/linux-firmware package. The binary redistributable software licenses are required to be accepted before the linux-firmware will install.

This license group can be accepted system-wide for any package by adding the @BINARY-REDISTRIBUTABLE as an ACCEPT_LICENSE value in the /etc/portage/make.conf file. It can be exclusively accepted for the linux-firmware package by adding a specific inclusion via a /etc/portage/package.license/linux-firmware file.

If necessary, review the methods of accepting software licenses available in the Installing the base system chapter of the handbook, then make some changes for acceptable software licenses.

If in analysis paralysis, the following will do the trick:

root #mkdir /etc/portage/package.license
FILE /etc/portage/package.license/linux-firmwareAccept binary redistributable licenses for the linux-firmware package
sys-kernel/linux-firmware @BINARY-REDISTRIBUTABLE

Installation

Vediamo ora come usare genkernel. Prima di tutto, installare sys-kernel/genkernel:

root #emerge --ask sys-kernel/genkernel

Generation

Ora, compilare i sorgenti del kernel eseguendo genkernel all. Attenzione, genkernel compila un kernel che supporta quasi tutto l'hardware possibile, questa compilazione richiederà molto tempo prima di arrivare alla fine!

Nota
Se la partizione di boot non usa ext2 o ext3 come filesystem potrebbe essere necessario configurare manualmente il kernel usando genkernel --menuconfig all e aggiungere il supporto a questo tipo particolare di filesystem nel kernel (ovvero, non come modulo). Gli utenti di LVM2 dovranno probabilmente aggiungere anche --lvm come argomento.
Nota
Users of LVM2 should add --lvm as an argument to the genkernel command below.
root #genkernel all

Quando genkernel conclude, vengono creati un kernel, un insieme completo di moduli e un disco RAM iniziale (initramfs). Useremo il kernel e l'initrd per configurare un boot loader più avanti in questo documento. Annotarsi i nomi del kernel e dell'initrd, in quanto queste informazioni verranno usate quando verrà modificato il file di configurazione del boot loader. L'initrd verrà avviato immediatamente dopo che il processo di avvio avrà effettuato l'autorilevamento dell'hardware (proprio come fa il CD di installazione) prima che il sistema "reale" si avvii.

root #ls /boot/kernel* /boot/initramfs*

Predefinito: Configurazione manuale

Introduzione

Nota
In case it was missed, this section requires the kernel sources to be installed. Be sure to obtain the relevant kernel sources, then return here for the rest of section.

Configurare manualmente un kernel è spesso considerata la procedura più difficile che un utente Linux debba compiere. Niente di più falso - dopo aver configurato un paio di kernel nessuno nemmeno ricorda che fosse difficile ;)

Comunque, una cosa è vera: è di vitale importanza conoscere il sistema quando si configura il kernel manualmente. La maggior parte delle informazioni si possono raccogliere installando sys-apps/pciutils che contiene il comando lspci:

root #emerge --ask sys-apps/pciutils
Nota
Dentro la chroot (radice cambiata), si possono ignorare con sicurezza gli avvisi pcilib (come pcilib: cannot open /sys/bus/pci/devices) che lspci potrebbere tirar fuori.

Un'altra fonte di informazioni è lsmod per vedere quali moduli del kernel il CD di installazione usa, poiché ciò potrebbe dare buone idee su cosa abilitare.

Adesso bisogna spostarsi nella directory del sorgente del kernel ed eseguire make menuconfig. Questo farà apparire il menù di configurazione.

root #cd /usr/src/linux
root #make menuconfig

La configurazione del kernel Linux ha molte, molte sezioni. Per prima cosa saranno elencate le opzioni che devono essere attivate (altrimenti Gentoo non funzionerà, o non funzionerà correttamente senza modifiche aggiuntive). Esiste anche una guida alla configurazione del kernel Gentoo nel wiki di Gentoo che potrebbe aiutare ulteriormente.

Abilitare le opzioni richieste

When using sys-kernel/gentoo-sources, it is strongly recommend the Gentoo-specific configuration options be enabled. These ensure that a minimum of kernel features required for proper functioning is available:

KERNEL Enabling Gentoo-specific options
Gentoo Linux --->
  Generic Driver Options --->
    [*] Gentoo Linux support
    [*]   Linux dynamic and persistent device naming (userspace devfs) support
    [*]   Select options required by Portage features
        Support for init systems, system and service managers  --->
          [*] OpenRC, runit and other script based systems and managers
          [*] systemd

Naturally the choice in the last two lines depends on the selected init system (OpenRC vs. systemd). It does not hurt to have support for both init systems enabled.

When using sys-kernel/vanilla-sources, the additional selections for init systems will be unavailable. Enabling support is possible, but goes beyond the scope of the handbook.

Enabling support for typical system components

Assicurarsi che ogni driver vitale per l'avvio del sistema (come un controller SCSI, ecc.) sia compilato nel kernel e non come modulo, altrimenti il sistema non sarà in grado di avviarsi completamente.

Proseguire selezionando l'esatto tipo di processore. È anche raccomandato abilitare le funzionalità MCE (se disponibili) così che gli utenti possano ricevere notifiche su eventuali problemi hardware. Su alcune architetture (come x86_64), questi errori non sono scritti su dmesg, ma su /dev/mcelog. Ciò richiede il pacchetto app-admin/mcelog.

Selezionare anche Maintain a devtmpfs file system to mount at /dev (Mantenere un file system devtmpfs da montare su /dev) così che i file dei dispositivi critici siano già presenti durante il processo di avvio (CONFIG_DEVTMPFS e CONFIG_DEVTMPFS_MOUNT):

KERNEL Abilitare il supporto a devtmpfs
Device Drivers --->
  Generic Driver Options --->
    [*] Maintain a devtmpfs filesystem to mount at /dev
    [ ]   Automount devtmpfs at /dev, after the kernel mounted the rootfs

Verificare che il supporto dischi SCSI sia stato attivato (CONFIG_BLK_DEV_SD):

KERNEL Abilitare il supporto dischi SCSI
Device Drivers --->
   SCSI device support  --->
      <*> SCSI disk support
KERNEL Enabling basic SATA and PATA support (CONFIG_ATA_ACPI, CONFIG_SATA_PMP, CONFIG_SATA_AHCI, CONFIG_ATA_BMDMA, CONFIG_ATA_SFF, CONFIG_ATA_PIIX)
Device Drivers --->
  <*> Serial ATA and Parallel ATA drivers (libata)  --->
    [*] ATA ACPI Support
    [*] SATA Port Multiplier support
    <*> AHCI SATA support (ahci)
    [*] ATA BMDMA support
    [*] ATA SFF support (for legacy IDE and PATA)
    <*> Intel ESB, ICH, PIIX3, PIIX4 PATA/SATA support (ata_piix)

Verify basic NVMe support has been enabled:

KERNEL Enable basic NVMe support for Linux 4.4.x (CONFIG_BLK_DEV_NVME)
Device Drivers  --->
  <*> NVM Express block device
KERNEL Enable basic NVMe support for Linux 5.x.x (CONFIG_DEVTMPFS)
Device Drivers --->
  NVME Support --->
    <*> NVM Express block device

It does not hurt to enable the following additional NVMe support:

KERNEL Enabling additional NVMe support (CONFIG_NVME_MULTIPATH, CONFIG_NVME_MULTIPATH, CONFIG_NVME_HWMON, CONFIG_NVME_FC, CONFIG_NVME_TCP, CONFIG_NVME_TARGET, CONFIG_NVME_TARGET_PASSTHRU, CONFIG_NVME_TARGET_LOOP, CONFIG_NVME_TARGET_FC, CONFIG_NVME_TARGET_FCLOOP, CONFIG_NVME_TARGET_TCP
[*] NVMe multipath support
[*] NVMe hardware monitoring
<M> NVM Express over Fabrics FC host driver
<M> NVM Express over Fabrics TCP host driver
<M> NVMe Target support
  [*]   NVMe Target Passthrough support
  <M>   NVMe loopback device support
  <M>   NVMe over Fabrics FC target driver
  < >     NVMe over Fabrics FC Transport Loopback Test driver (NEW)
  <M>   NVMe over Fabrics TCP target support

Adesso andare su File Systems e selezionare il supporto ai file system desiderati. Non si compili il file system usato per la radice (root) come modulo, altrimenti Gentoo non sarà in grado di montare questa partizione. Selezionare anche Virtual memory e /proc file system. Selezionare una o più delle seguenti opzioni come richiesto dal sistema (CONFIG_EXT2_FS, CONFIG_EXT3_FS, CONFIG_EXT4_FS, CONFIG_MSDOS_FS, CONFIG_VFAT_FS, CONFIG_PROC_FS, e CONFIG_TMPFS):

KERNEL Selezionare i file system necessari
File systems --->
  <*> Second extended fs support
  <*> The Extended 3 (ext3) filesystem
  <*> The Extended 4 (ext4) filesystem
  <*> Reiserfs support
  <*> JFS filesystem support
  <*> XFS filesystem support
  <*> Btrfs filesystem support
  DOS/FAT/NT Filesystems  --->
    <*> MSDOS fs support
    <*> VFAT (Windows-95) fs support
 
Pseudo Filesystems --->
    [*] /proc file system support
    [*] Tmpfs virtual memory file system support (former shm fs)

Se PPPoE è usato per connettersi ad Internet, o un modem dial-up, allora abilitare le seguenti opzioni (CONFIG_PPP, CONFIG_PPP_ASYNC, e CONFIG_PPP_SYNC_TTY):

KERNEL Selezionare i driver necessari per PPPoE
Device Drivers --->
  Network device support --->
    <*> PPP (point-to-point protocol) support
    <*>   PPP support for async serial ports
    <*>   PPP support for sync tty ports

Le due opzioni di compressione non causaranno danni, ma non sono assolutamente necessarie, né lo è l'opzione PPP attraverso Ethernet, che potrebbe essere utilizzata solo da ppp quando configurata per eseguire PPPoE in modalità kernel.

Non si dimentichi di includere il supporto nel kernel per le schede di rete (Ethernet o wireless).

La maggior parte dei sistemi dispone di più core, quindi è importante attivare Symmetric multi-processing support (CONFIG_SMP):

KERNEL Abilitare il supporto SMP
Processor type and features  --->
  [*] Symmetric multi-processing support
Nota
Nei sistemi multi-core, ogni core conta come un processore.

Se verranno utilizzati dispositivi di input USB (come tastiera o mouse) o altri dispositivi USB, non si dimentichi di abilitare anche quelli (CONFIG_HID_GENERIC e CONFIG_USB_HID, CONFIG_USB_SUPPORT, CONFIG_USB_XHCI_HCD, CONFIG_USB_EHCI_HCD, CONFIG_USB_OHCI_HCD):

KERNEL Abilitare supporto USB per dispositivi di input
Device Drivers --->
  HID support  --->
    -*- HID bus support
    <*>   Generic HID driver
    [*]   Battery level reporting for HID devices
      USB HID support  --->
        <*> USB HID transport layer
  [*] USB support  --->
    <*>     xHCI HCD (USB 3.0) support
    <*>     EHCI HCD (USB 2.0) support
    <*>     OHCI HCD (USB 1.1) support

Optional: Signed kernel modules

To automatically sign the kernel modules enable CONFIG_MODULE_SIG_ALL:

KERNEL Sign kernel modules CONFIG_MODULE_SIG_ALL
[*] Enable loadable module support  
  -*-   Module signature verification    
    [*]     Automatically sign all modules    
    Which hash algorithm should modules be signed with? (Sign modules with SHA-512) --->

Optionally change the hash algorithm if desired.

To enforce that all modules are signed with a valid signature, enable CONFIG_MODULE_SIG_FORCE as well:

KERNEL Enforce signed kernel modules CONFIG_MODULE_SIG_FORCE
[*] Enable loadable module support  
  -*-   Module signature verification    
    [*]     Require modules to be validly signed
    [*]     Automatically sign all modules
    Which hash algorithm should modules be signed with? (Sign modules with SHA-512) --->

To use a custom key, specify the location of this key in CONFIG_MODULE_SIG_KEY, if unspecified the kernel build system will generate a key. It is recommended to generate one manually instead. This can be done with:

root #openssl req -new -nodes -utf8 -sha256 -x509 -outform PEM -out kernel_key.pem -keyout kernel_key.pem

OpenSSL will ask some questions about the user generating the key, it is recommended to fill in these questions as detailed as possible.

Store the key in a safe location, at the very least the key should be readable only by the root user. Verify this with:

root #ls -l kernel_key.pem
 -r-------- 1 root root 3164 Jan  4 10:38 kernel_key.pem 

If this outputs anything other then the above, correct the permissions with:

root #chown root:root kernel_key.pem
root #chmod 400 kernel_key.pem
KERNEL Specify signing key CONFIG_MODULE_SIG_KEY
-*- Cryptographic API  ---> 
  Certificates for signature checking  --->  
    (/path/to/kernel_key.pem) File name or PKCS#11 URI of module signing key

To also sign external kernel modules installed by other packages via linux-mod-r1.eclass, enable the modules-sign USE flag globally:

FILE /etc/portage/make.confEnable module signing
USE="modules-sign"
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
# Optionally, when using custom signing keys.
MODULES_SIGN_KEY="/path/to/kernel_key.pem"
MODULES_SIGN_CERT="/path/to/kernel_key.pem" # Only required if the MODULES_SIGN_KEY does not also contain the certificate
MODULES_SIGN_HASH="sha512" # Defaults to sha512
Nota
The MODULES_SIGN_KEY and MODULES_SIGN_CERT may be different files. For this example the pem file generated by OpenSSL includes both the key and the accompanying certificate, and thus both variables are set to the same value.

Optional: Signing the kernel image (Secure Boot)

When signing the kernel image (for use on systems with Secure Boot enabled) it is recommended to set the following kernel config options:

KERNEL Lockdown for secureboot
General setup  --->
  Kexec and crash features  --->   
    [*] Enable kexec system call                                                                                          
    [*] Enable kexec file based system call                                                                               
    [*]   Verify kernel signature during kexec_file_load() syscall                                                        
    [*]     Require a valid signature in kexec_file_load() syscall                                                        
    [*]     Enable ""image"" signature verification support
</div>  

<div lang="en" dir="ltr" class="mw-content-ltr">
[*] Enable loadable module support  
  -*-   Module signature verification    
    [*]     Require modules to be validly signed
    [*]     Automatically sign all modules
    Which hash algorithm should modules be signed with? (Sign modules with SHA-512) --->
</div>  

<div lang="en" dir="ltr" class="mw-content-ltr">
Security options  ---> 
[*] Integrity subsystem   
  [*] Basic module for enforcing kernel lockdown                                                                       
  [*]   Enable lockdown LSM early in init                                                                       
        Kernel default lockdown mode (Integrity)  --->
</div>            

  <div lang="en" dir="ltr" class="mw-content-ltr">
[*]   Digital signature verification using multiple keyrings                                                            
  [*]     Enable asymmetric keys support                                                                                     
  -*-       Require all keys on the integrity keyrings be signed                                                              
  [*]       Provide keyring for platform/firmware trusted keys                                                                
  [*]       Provide a keyring to which Machine Owner Keys may be added                                                        
  [ ]         Enforce Machine Keyring CA Restrictions

Where ""image"" is a placeholder for the architecture specific image name. These options, from the top to the bottom: enforces that the kernel image in a kexec call must be signed (kexec allows replacing the kernel in-place), enforces that kernel modules are signed, enables lockdown integrity mode (prevents modifying the kernel at runtime), and enables various keychains.

On arches that do not natively support decompressing the kernel (e.g. arm64 and riscv), the kernel must be built with its own decompressor (zboot):

KERNEL zboot CONFIG_EFI_ZBOOT
Device Drivers --->                                                                                                                           
  Firmware Drivers --->                                                                                                                       
    EFI (Extensible Firmware Interface) Support --->                                                                                               
      [*] Enable the generic EFI decompressor

After compilation of the kernel, as explained in the next section, the kernel image must be signed. First install app-crypt/sbsigntools and then sign the kernel image:

root #emerge --ask app-crypt/sbsigntools
root #sbsign /usr/src/linux-x.y.z/path/to/kernel-image --cert /path/to/kernel_key.pem --key /path/to/kernel_key.pem --out /usr/src/linux-x.y.z/path/to/kernel-image
Nota
For this example the same key that was generated to sign the modules is used to sign the kernel image. It is also possible to generate and use a second sperate key for signing the kernel image. The same OpenSSL command as in the previous section may be used again.

Then proceed with the installation.

To automatically sign EFI executables installed by other packages, enable the secureboot USE flag globally:

FILE /etc/portage/make.confEnable Secure Boot
USE="modules-sign secureboot"
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
# Optionally, to use custom signing keys.
MODULES_SIGN_KEY="/path/to/kernel_key.pem"
MODULES_SIGN_CERT="/path/to/kernel_key.pem" # Only required if the MODULES_SIGN_KEY does not also contain the certificate.
MODULES_SIGN_HASH="sha512" # Defaults to sha512
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
# Optionally, to boot with secureboot enabled, may be the same or different signing key.
SECUREBOOT_SIGN_KEY="/path/to/kernel_key.pem"
SECUREBOOT_SIGN_CERT="/path/to/kernel_key.pem"
Nota
The SECUREBOOT_SIGN_KEY and SECUREBOOT_SIGN_CERT may be different files. For this example the pem file generated by OpenSSL includes both the key and the accompanying certificate, and thus both variables are set to the same value.
Nota
When generating an Unified Kernel Image with systemd's ukify the kernel image will be signed automatically before inclusion in the unified kernel image and it is not necessary to sign it manually.

Handbook:SPARC/Blocks/Kernel/it

Kernel installation

Installkernel

Installkernel may be used to automate, the kernel installation, initramfs generation, unified kernel image generation and/or bootloader configuration among other things. sys-kernel/installkernel implements two paths of achieving this: the traditional installkernel originating from Debian and systemd's kernel-install. Which one to choose depends, among other things, on the system's bootloader. By default systemd's kernel-install is used on systemd profiles, while the traditional installkernel is the default for other profiles.

If unsure, follow the 'Traditional layout' subsection below.

systemd-boot

When using systemd-boot (formerly gummiboot) as the bootloader, systemd's kernel-install must be used. Therefore ensure the systemd and the systemd-boot USE flags are enabled on sys-kernel/installkernel, and then install the relevant package for systemd-boot.

On OpenRC systems:

FILE /etc/portage/package.use/systemd-boot
sys-apps/systemd-utils boot kernel-install
sys-kernel/installkernel systemd systemd-boot
root #emerge --ask sys-apps/systemd-utils

On systemd systems:

FILE /etc/portage/package.use/systemd
sys-apps/systemd boot
sys-kernel/installkernel systemd-boot
# Needed for <systemd-254
sys-apps/systemd gnuefi
root #emerge --ask sys-apps/systemd

GRUB

Users of GRUB can use either systemd's kernel-install or the traditional Debian installkernel. The systemd USE flag switches between these implementations. To automatically run grub-mkconfig when installing the kernel, enable the grub USE flag.

FILE /etc/portage/package.use/installkernel
sys-kernel/installkernel grub
root #emerge --ask sys-kernel/installkernel

When systemd's kernel-install is used, it should be configured to use the grub layout, this is the default if the grub USE flag is enabled:

FILE /etc/kernel/install.conf
layout=grub

Traditional layout, other bootloaders (e.g. lilo, etc.)

The traditional /boot layout (for e.g. LILO, etc.) is used by default if the grub, systemd-boot and uki USE flags are not enabled. No further action is required.


Building an initramfs

In certain cases it is necessary to build an initramfs - an initial ram-based file system. The most common reason is when important file system locations (like /usr/ or /var/) are on separate partitions. With an initramfs, these partitions can be mounted using the tools available inside the initramfs. The default configuration of the Project:Distribution Kernel requires an initramfs.

Without an initramfs, there is a risk that the system will not boot properly as the tools that are responsible for mounting the file systems require information that resides on unmounted file systems. An initramfs will pull in the necessary files into an archive which is used right after the kernel boots, but before the control is handed over to the init tool. Scripts on the initramfs will then make sure that the partitions are properly mounted before the system continues booting.

Importante
If using genkernel, it should be used for both building the kernel and the initramfs. When using genkernel only for generating an initramfs, it is crucial to pass --kernel-config=/path/to/kernel.config to genkernel or the generated initramfs may not work with a manually built kernel. Note that manually built kernels go beyond the scope of support for the handbook. See the kernel configuration article for more information.

Installkernel can automatically generate an initramfs when installing the kernel if the dracut USE flag is enabled:

FILE /etc/portage/package.use/installkernel
sys-kernel/installkernel dracut

Alternatively, dracut may be called manually to generate an initramfs. Install sys-kernel/dracut first, then have it generate an initramfs:

root #emerge --ask sys-kernel/dracut
root #dracut --kver=3.16.5-gentoo

The initramfs will be stored in /boot/. The resulting file can be found by simply listing the files starting with initramfs:

root #ls /boot/initramfs*

Optional: Building an Unified Kernel Image

An Unified Kernel Image (UKI) combines, among other things, the kernel, the initramfs and the kernel command line into a single executable. Since the kernel command line is embedded into the unified kernel image it should be specified before generating the unified kernel image (see below). Note that any kernel command line arguments supplied by the bootloader or firmware at boot are ignored when booting with secure boot enabled.

An unified kernel image requires a stub loader, currently the only one available is systemd-stub. To enable it:

For systemd systems:

FILE /etc/portage/package.use/systemd
sys-apps/systemd boot

For OpenRC systems:

FILE /etc/portage/package.use/systemd-utils
sys-apps/systemd-utils boot

Installkernel can automatically generate an unified kernel image using either dracut or ukify, by enabling the respective flag. The uki USE flag should be enabled as well to install the generated unified kernel image to the $ESP/EFI/Linux directory on the EFI system partition (ESP).

For dracut:

FILE /etc/portage/package.use/installkernel
sys-kernel/installkernel dracut uki
FILE /etc/dracut.conf
uefi="yes"
kernel_cmdline="some-kernel-command-line-arguments"

For ukify:

FILE /etc/portage/package.use/installkernel
sys-kernel/installkernel dracut ukify uki
FILE /etc/kernel/cmdline
some-kernel-command-line-arguments

Note that while dracut can generate both an initramfs and an unified kernel image, ukify can only generate the latter and therefore the initramfs must be generated separately with dracut.

Generic Unified Kernel Image

The prebuilt sys-kernel/gentoo-kernel-bin can optionally install a prebuilt generic unified kernel image containing a generic initramfs that is able to boot most systemd based systems. It can be installed by enabling the generic-uki USE flag, and configuring installkernel to not generate a custom initramfs or unified kernel image:

FILE /etc/portage/package.use/generic-uki
sys-kernel/gentoo-kernel-bin generic-uki
sys-kernel/installkernel -dracut -ukify uki

Secure Boot

The generic Unified Kernel Image optionally distributed by sys-kernel/gentoo-kernel-bin is already pre-signed. How to sign a locally generated unified kernel image depends on whether dracut or ukify is used. Note that the location of the key and certificate should be the same as the SECUREBOOT_SIGN_KEY and SECUREBOOT_SIGN_CERT as specified in /etc/portage/make.conf.

For dracut:

FILE /etc/dracut.conf
uefi="yes"
kernel_cmdline="some-kernel-command-line-arguments"
uefi_secureboot_key="/path/to/kernel_key.pem"
uefi_secureboot_cert="/path/to/kernel_key.pem"

For ukify:

FILE /etc/kernel/uki.conf
[UKI]
SecureBootPrivateKey=/path/to/kernel_key.pem
SecureBootCertificate=/path/to/kernel_key.pem

Rebuilding external kernel modules

External kernel modules installed by other packages via linux-mod-r1.eclass must be rebuilt for each new kernel version. When the distribution kernels are used this may be automated by enabling the dist-kernel flag globally.

FILE /etc/portage/package.use/module-rebuild
*/* dist-kernel

External kernel modules may also be rebuilt manually with:

root #emerge --ask @module-rebuild

Moduli del kernel

Configurazione dei moduli

Nota
Hardware modules are optional to be listed manually. udev will normally load all hardware modules that are detected to be connected in most cases. However, it is not harmful for modules that will be automatically loaded to be listed. Modules cannot be loaded twice; they are either loaded or unloaded. Sometimes exotic hardware requires help to load their drivers.

Elencare i moduli, che serve caricare automaticamente, su /etc/conf.d/modules. Anche le opzioni extra possono essere aggiunte ai moduli se necessario.

Per visualizzare tutti i moduli disponibili, eseguire il seguente comando find. Non dimenticarsi di sostituire "<versione del kernel>" con la versione del kernel appena compilata:

root #find /lib/modules/<versione del kernel>/ -type f -iname '*.o' -or -iname '*.ko' | less

Force loading particular kernel modules

Per esempio, per caricare automaticamente il modulo 3c59x.ko (che è il driver per una famiglia specifica di schede di rete 3Com), modificare il file /etc/conf.d/modules ed inserirvi il nome del modulo.

root #nano -w /etc/conf.d/modules
modules="3c59x"

Note that the module's .ko file suffix is insignificant to the loading mechanism and left out of the configuration file:

FILE /etc/modules-load.d/network.confForce loading 3c59x module
3c59x

Continuare l'installazione con la Configurazione del sistema.




Informazioni sul file system

Etichette dei file system e UUID

Sia MBR (BIOS) che GPT includono il supporto per le etichette e gli UUID dei file system. Questi attributi possono essere definiti in /etc/fstab come alternative per il comando mount da usare quando si tenta di trovare e montare i dispositivi a blocchi. Le etichette e gli UUID dei file system sono identificati dai prefissi LABEL e UUID e possono essere visionati con il comando blkid:

root #blkid
Attenzione
Se il file system dentro la partizione viene eliminato, allora i valori delle etichette e degli UUID del file system saranno conseguentemente alterati o rimossi.

Per via della sua unicità, si raccomanda ai lettori, che stanno usando una tabella delle partizioni stile MBR, di usare gli UUID anziché le etichette per definire i volumi da montare nel file /etc/fstab.

Importante
UUIDs of the filesystem on a LVM volume and its LVM snapshots are identical, therefore using UUIDs to mount LVM volumes should be avoided.

Etichette e UUID delle partizioni

Gli utenti che hanno scelto la strada GPT hanno un paio di 'robuste' opzioni disponibili per definire le partizioni su /etc/fstab. Le etichette e gli UUID delle partizioni possono essere usate per identificare le o la partizione individuale del dispositivo a blocchi, senza badare a quale file system è stato scelto per la partizione stessa. Le etichette e gli UUID sono identificati rispettivamente dai prefissi PARTLABEL e PARTUUID e possono essere comodamente visionati da terminale con il comando blkid:

Output for an amd64 EFI system using the Discoverable Partition Specification UUIDs may like the following:

root #blkid

Mentre non sempre è vero per le etichette delle partizioni, usando un UUID per identificare una partizione su fstab fornisce una garanzia che l'avviatore non farà confusione quando ricercherà un certo volume, persino quando il file system dovesse cambiare in futuro. Usare i percorsi per i dispositivi a blocchi predefiniti (/dev/sd*N) per definire le partizioni su fstab è rischioso per i sistemi che vengono riavviati spesso ed hanno dispositivi a blocchi SATA che vengono aggiunti e rimossi regolarmente.

La denominazione dei percorsi dei dispositivi a blocchi dipende da un certo numero di fattori, incluso come ed in quale ordine i dischi sono attaccati al sistema. Essi potrebbero anche apparire in un ordine differente in base a quali dispositivi vengono rilevati prima dal kernel durante la prima fase del processo di avvio. Premesso ciò, a meno che uno non intenda avere continuamente a che fare con l'ordinamento dei dischi, usare i percorsi predefiniti per i dispositivi a blocchi è un approccio semplice e diretto.

Riguardo fstab

Su Linux, tutte le partizioni usate dal sistema devono essere elencate in /etc/fstab. Questo file contiene i punti di montaggio di quelle partizioni (cioè dove esse verranno viste rispetto alla struttura del file system), come dovranno essere montate e con quali opzioni speciali (automaticamente o meno, se gli utenti potranno montarle o meno, ecc.).

Creare il file fstab

Il file /etc/fstab usa una sintassi stile tabella. Ogni linea consiste in sei campi, separati da uno spazio bianco (uno o più spazi, tabulazioni, o un misto). Ogni campo ha il suo specifico significato:

  1. Il primo campo mostra il dispositivo a blocchi speciale o il file system in remoto che deve essere montato. Svariati tipi di identificatori di dispositivi sono disponibili per i nodi dei dispositivi a blocchi speciali, etichette di file system e UUID, ed etichette di partizioni e UUID.
  2. Il secondo campo mostra il punto di montaggio sul quale la partizione andrebbe montata.
  3. Il terzo campo mostra il file system usato dalla partizione
  4. Il quarto campo mostra le opzioni di montaggio usate da mount quando si vuole montare la partizione. Siccome ogni file system ha le sue opzioni di montaggio, gli utenti sono incoraggiati a leggere la pagina del manuale di mount (man mount) per averne una lista completa. Opzioni multiple di montaggio vanno separate con una virgola.
  5. Il quinto campo è usato da dump (copia del contenuto della memoria) per determinare se la partizione necessità di ricevere un dump oppure no. Questo valore viene generalmente lasciato a 0 (zero).
  6. Il sesto campo è usato da fsck per determinare l'ordine in cui i file system dovrebbero essere controllati quando il sistema non si arresta correttamente. Il file system radice (root) dovrebbe avere 1 mentre i rimanenti dovrebbero avere 2 (oppure 0 se il controllo del file system non è necessario).
Importante
Il file predefinito /etc/fstab fornito da Gentoo non è un file fstab valido, però offre più di un modello soltanto.
root #nano -w /etc/fstab

DOS/Legacy BIOS systems


Aggiungere regole che corrispondano al precedente schema di partizionamento deciso ed aggiungere regole per i dispositivi come i lettori CD-ROM e, certamente, per ogni altra partizione o lettore (drive) in uso.

Sotto c'è un esempio molto più elaborato del file /etc/fstab:

FILE /etc/fstabUn esempio completo per /etc/fstab
/dev/sda2   none         swap    sw                   0 0
/dev/sda1   /            ext4    noatime              0 1
  
/dev/cdrom  /mnt/cdrom   auto    noauto,user          0 0

/dev/cdrom /mnt/cdrom auto noauto,user 0 0 }}

UEFI systems

Below is an example of an /etc/fstab file for a system that will boot via UEFI firmware:

FILE /etc/fstabA full /etc/fstab example for an UEFI system
# Adjust for any formatting differences and/or additional partitions created from the "Preparing the disks" step
                    0 2
/dev/sda2   none             sw                   0 0
/dev/sda1   /            xfs    defaults,noatime              0 1
</div>

<div lang="en" dir="ltr" class="mw-content-ltr">
/dev/cdrom  /mnt/cdrom   auto    noauto,user          0 0

DPS UEFI PARTUUID

Below is an example of an /etc/fstab file for a disk formatted with a GPT disklabel and Discoverable Partition Specification (DPS) UUIDs set for UEFI firmware:

FILE /etc/fstabGPT disklabel DPS PARTUUID fstab example
# Adjust any formatting difference and additional partitions created from the "Preparing the disks" step.
# This example shows a GPT disklabel with Discoverable Partition Specification (DSP) UUID set:
PARTUUID=                                  0 2
PARTUUID=   none            sw                           0 0
PARTUUID=   /           xfs    defaults,noatime              0 1

Quando si usa nel terzo campo auto, lascia che il comando mount indovini quale file system ci sia. Questo è raccomandato per i supporti removibili in quanto possono essere creati con uno tra tanti file system. L'opzione user nel quarto campo rende possibile ad un utente non-root (non amministratore o "radice") montare il CD.

To improve performance, most users would want to add the noatime mount option, which results in a faster system since access times are not registered (those are not needed generally anyway). This is also recommended for systems with solid state drives (SSDs). Users may wish to consider lazytime instead.

Suggerimento
Due to degradation in performance, defining the discard mount option in /etc/fstab is not recommended. It is generally better to schedule block discards on a periodic basis using a job scheduler such as cron or a timer (systemd). See Periodic fstrim jobs for more information.

Controllare due volte il file /etc/fstab, salvare ed uscire per continuare.

Informazioni di rete

It is important to note the following sections are provided to help the reader quickly setup their system to partake in a local area network.

For systems running OpenRC, a more detailed reference for network setup is available in the advanced network configuration section, which is covered near the end of the handbook. Systems with more specific network needs may need to skip ahead, then return here to continue with the rest of the installation.

For more specific systemd network setup, please review see the networking portion of the systemd article.

Informazioni host e dominio

Una delle scelte che l'utente deve compiere è dare un nome al suo PC. Questo sembra piuttosto facile, ma molti utenti hanno difficoltà a trovare il nome appropriato per il proprio PC Linux. Per velocizzare le cose, si sappia che la decisione non è definitiva - può essere cambiata in seguito. Nell'esempio sottostante il nome host tux è stato usato all'interno del dominio homenetwork (rete di casa).

Set the hostname (OpenRC or systemd)

root #echo tux > /etc/hostname

systemd

To set the system hostname for a system currently running systemd, the hostnamectl utility may be used. During the installation process however, systemd-firstboot command must be used instead (see later on in handbook).

For setting the hostname to "tux", one would run:

root #hostnamectl hostname tux

View help by running hostnamectl --help or man 1 hostnamectl.

Network

There are many options available for configuring network interfaces. This section covers a only a few methods. Choose the one which seems best suited to the setup needed.

DHCP via dhcpcd (any init system)

Most LAN networks operate a DHCP server. If this is the case, then using the dhcpcd program to obtain an IP address is recommended.

To install:

root #emerge --ask net-misc/dhcpcd

To enable and then start the service on OpenRC systems:

root #rc-update add dhcpcd default
root #rc-service dhcpcd start

To enable the service on systemd systems:

root #systemctl enable dhcpcd

With these steps completed, next time the system boots, dhcpcd should obtain an IP address from the DHCP server. See the Dhcpcd article for more details.

netifrc (OpenRC)

Suggerimento
This is one particular way of setting up the network using Netifrc on OpenRC. Other methods exist for simpler setups like Dhcpcd.

Configurare la rete

Durante l'installazione di Gentoo Linux, la rete per lavorare era già configurata. Comunque, ciò valeva per il CD di installazione stesso e non per l'ambiente installato. Adesso, la configurazione di rete è stata fatta per il sistema Gentoo Linux installato.

Nota
Informazioni più dettagliate sul lavoro di rete, inclusi argomenti avanzati come collegamenti, ponti, VLAN 802.1Q o reti wireless sono trattati nella sezione della Configurazione delle reti su Gentoo.

Tutte le informazioni di rete sono raccolte su /etc/conf.d/net. La sintassi è lineare ma forse non ancora intuitiva. Ma niente paura, ogni cosa sarà spiegata di seguito. Un esempio completamente commentato che copre molte diverse configurazioni è disponibile in /usr/share/doc/netifrc-*/net.example.bz2.

Prima installare net-misc/netifrc:

root #emerge --ask --noreplace net-misc/netifrc

DHCP è usato in modo predefinito. Affinché DHCP funzioni, è necessario installare un client DHCP. Ciò viene descritto più avanti negli Strumenti di sistema necessari per l'installazione.

Se la connessione di rete necessita di essere configurata a causa di opzioni specifiche per DHCP o perché DHCP non è usato affatto, allora si apra /etc/conf.d/net:

root #nano -w /etc/conf.d/net

Impostare sia config_eth0 che routes_eth0 per inserire le informazioni sull'indirizzo IP e sull'instradamento.

Nota
Si presume che l'interfaccia di rete sia chiamata eth0. Comunque, ciò dipende strettamente dal sistema. È raccomandato assumere che l'interfaccia sia nominata con il nome dell'interfaccia presente all'avvio del mezzo di installazione, considerando che il mezzo di installazione sia abbastanza recente. Maggiori informazioni si possono trovare su Denominazione delle interfacce di rete.
FILE /etc/conf.d/netDefinizione di un IP statico
config_eth0="192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255"
routes_eth0="default via 192.168.0.1"

Per usare DHCP, definire config_eth0:

FILE /etc/conf.d/netDefinizione di DHCP
config_eth0="dhcp"

Si legga /usr/share/doc/netifrc-*/net.example.bz2 per un elenco completo delle opzioni disponibili. Assicurarsi di controllare bene anche la pagina man (manuale) del client DHCP se è necessario impostare opzioni specifiche per DHCP.

Se il sistema ha svariate interfacce di rete, allora ripetere i passi precedenti per config_eth1, config_eth2, ecc.

Adesso salvare la configurazione ed uscire per proseguire.

Avvio automatico dei servizi di rete

Per avere le interfacce di rete attive all'avvio, esse vanno aggiunte al runlevel (livello di esecuzione) predefinito.

root #cd /etc/init.d
root #ln -s net.lo net.eth0
root #rc-update add net.eth0 default

Se il sistema ha diverse interfacce di rete, allora gli appropriati file net.* devono essere creati come è stato fatto con net.eth0.

Se dopo aver avviato il sistema, risulta che il nome assunto per l'interfaccia di rete (attualmente nella documentazione come eth0) era sbagliato, allora si eseguano i seguenti passaggi per correggerlo:

  1. Aggiornare il file /etc/conf.d/net con il nome di interfaccia corretto (per esempio enp3s0 anziché eth0).
  2. Creare un nuovo link simbolico (esempio /etc/init.d/net.enp3s0).
  3. Rimuovere il vecchio link simbolico (rm /etc/init.d/net.eth0).
  4. Aggiungere quello nuovo al runlevel (livello di esecuzione) predefinito.
  5. Rimuovere quello vecchio con rc-update del net.eth0 default.

Il file degli host

Si passa ad informare Linux riguardo l'ambiente di rete. Questo è definito su /etc/hosts ed aiuta a risolvere i nomi host permettendo di ottenere gli indirizzi IP per gli host che non sono risolti dal nameserver (server dei nomi).

root #nano -w /etc/hosts
FILE /etc/hostsCompilazione delle informazioni di rete
# This defines the current system and must be set
# Questo definisce il sistema stesso e deve essere impostato
127.0.0.1     tux.homenetwork tux localhost
  
# Optional definition of extra systems on the network
# Definizione opzionale per sistema extra sulla rete
192.168.0.5   jenny.homenetwork jenny
192.168.0.6   benny.homenetwork benny

Salvare ed uscire dall'editor per continuare.

Informazioni di sistema

Password root

Impostare la password per root (radice) usando il comando passwd.

root #passwd

L'account Linux root è un account con tutti i poteri, dunque si scelga una password robusta. In seguito, verranno creati degli account aggiuntivi per le operazioni quotidiane degli utenti ordinari.

Configurazione init e all'avvio

OpenRC

Gentoo (almeno quando si usa OpenRC) usa /etc/rc.conf per configurare i servizi, la partenza, e lo spegnimento del sistema. Aprire /etc/rc.conf e divertirsi con tutti i commenti nel file. Rivedere le impostazioni e cambiarle dove necessario.

root #nano -w /etc/rc.conf

Poi, aprire /etc/conf.d/keymaps per gestire la configurazione della tastiera. Modificare il file per configurare ed impostare correttamente la tastiera.

root #nano -w /etc/conf.d/keymaps

Si presti particolare attenzione alla variabile keymap. Se viene selezionata la mappa dei tasti sbagliata, quando si digita sulla tastiera verranno visualizzati strani risultati.

Infine, modificare /etc/conf.d/hwclock per impostare le opzioni dell'orologio. Modificarlo secondo le preferenze personali.

root #nano -w /etc/conf.d/hwclock

Se l'orologio hardware non sta usando UTC, allora è necessario impostare clock="local" nel file. Nel caso contrario, ciò comporterebbe disallineamenti dell'ora nel sistema.

systemd

First, it is recommended to run systemd-machine-id-setup and then systemd-firstboot which will prepare various components of the system are set correctly for the first boot into the new systemd environment. The passing the following options will include a prompt for the user to set a locale, timezone, hostname, root password, and root shell values. It will also assign a random machine ID to the installation:

root #systemd-machine-id-setup
root #systemd-firstboot --prompt

Next users should run systemctl to reset all installed unit files to the preset policy values:

root #systemctl preset-all --preset-mode=enable-only

It's possible to run the full preset changes but this may reset any services which were already configured during the process:

root #systemctl preset-all

These two steps will help ensure a smooth transition from the live environment to the installation's first boot.




Registratore di sistema

OpenRC

Alcuni strumenti risultano assenti sull'archivio stage3, dato che numerosi pacchetti forniscono le stesse funzionalità. Spetta all'utente scegliere quali installare.

Il primo strumento su cui decidere fornisce facilitazioni sulla registrazione degli eventi di sistema (log). Unix e Linux hanno un'eccellente storia sulle loro capacità di annotazione degli eventi - se necessario, qualsiasi cosa succede al sistema può essere registrato nei file di log. Questo avviene tramite un registratore di sistema (logger).

Gentoo offre numerose utilità di registrazione di sistema. Alcune di queste includono:

  • app-admin/sysklogd - Offre l'insieme tradizionale dei servizi di log di sistema. La configurazione predefinita per il log funziona bene così com'è, ciò rende il pacchetto una buona opzione per i principianti.
  • app-admin/syslog-ng - Un sistema avanzato di log. Richiede una configurazione aggiuntiva per qualsiasi cosa che va oltre la registrazione su un unico grande file. Gli utenti più esperti possono scegliere questo pacchetto per il suo potenziale di registrazione; si presti attenzione alla configurazione aggiuntiva, la quale è necessaria per qualsiasi tipo di registrazione intelligente.
  • app-admin/metalog - Un registratore di sistema ampiamente configurabile.

Altri ancora sono disponibili attraverso Portage - il numero di pacchetti disponibili aumenta giorno per giorno.

Suggerimento
Se si intende usare sysklogd o syslog-ng, è raccomandato installare e configurare logrotate in seguito, poiché questi registratori (logger) di sistema non forniscono alcun meccanismo di rotazione per i file di registro (log).

Per installare il registratore di sistema scelto, emergerlo (emerge) e farlo aggiungere al livello di esecuzione (runlevel) predefinito usando rc-update. Il seguente esempio installa app-admin/sysklogd:

root #emerge --ask app-admin/sysklogd
root #rc-update add sysklogd default

systemd

While a selection of logging mechanisms are presented for OpenRC-based systems, systemd includes a built-in logger called the systemd-journald service. The systemd-journald service is capable of handling most of the logging functionality outlined in the previous system logger section. That is to say, the majority of installations that will run systemd as the system and service manager can safely skip adding a additional syslog utilities.

See man journalctl for more details on using journalctl to query and review the systems logs.

For a number of reasons, such as the case of forwarding logs to a central host, it may be important to include redundant system logging mechanisms on a systemd-based system. This is a irregular occurrence for the handbook's typical audience and considered an advanced use case. It is therefore not covered by the handbook.

Opzionale: Servizio cron

OpenRC

Il prossimo è il servizio o demone cron. Sebbene sia opzionale e non richiesto su tutti i sistemi, è saggio averne uno.

Un servizio cron esegue comandi programmati. È molto comodo in caso di comandi da eseguire regolarmente (per esempio, ogni giorno, ogni settimana, od ogni mese).

All cron daemons support high levels of granularity for scheduled tasks, and generally include the ability to send an email or other form of notification if a scheduled task does not complete as expected.

Gentoo offre numerosi possibili servizi cron, tra cui sys-process/bcron, sys-process/dcron, sys-process/fcron, e sys-process/cronie. Installare uno di questi è simile all'installazione di un registratore di sistema. Il seguente esempio usa sys-process/cronie:

  • sys-process/cronie - cronie is based on the original cron and has security and configuration enhancements like the ability to use PAM and SELinux.
  • sys-process/dcron - This lightweight cron daemon aims to be simple and secure, with just enough features to stay useful.
  • sys-process/fcron - A command scheduler with extended capabilities over cron and anacron.
  • sys-process/bcron - A younger cron system designed with secure operations in mind. To do this, the system is divided into several separate programs, each responsible for a separate task, with strictly controlled communications between parts.

cronie

The following example uses sys-process/cronie:

root #emerge --ask sys-process/cronie
root #rc-update add cronie default
root #rc-update add cronie default

Alternative: dcron

root #emerge --ask sys-process/dcron

Se vengono usati dcron o fcron, un comando di inizializzazione aggiuntivo deve essere eseguito:

root #crontab /etc/crontab

Alternative: fcron

root #emerge --ask sys-process/fcron

If fcron is the selected scheduled task handler, an additional emerge step is required:

root #emerge --config sys-process/fcron

Alternative: bcron

bcron is a younger cron agent with built-in privilege separation.

root #emerge --ask sys-process/bcron

systemd

Similar to system logging, systemd-based systems include support for scheduled tasks out-of-the-box in the form of timers. systemd timers can run at a system-level or a user-level and include the same functionality that a traditional cron daemon would provide. Unless redundant capabilities are necessary, installing an additional task scheduler such as a cron daemon is generally unnecessary and can be safely skipped.

Opzionale: Indicizzazione dei file

Allo scopo di indicizzae il filesystem per avere capacità di localizzazione dei file più veloci, installare sys-apps/mlocate.

root #emerge --ask sys-apps/mlocate

Opzionale: Accesso remoto

Suggerimento
opensshd's default configuration does not allow root to login as a remote user. Please create a non-root user and configure it appropriately to allow access post-installation if required, or adjust /etc/ssh/sshd_config to allow root.

Per avere la possibilità di accedere al sistema da remoto dopo l'installazione, aggiungere lo script di init sshd al livello di esecuzione (runlevel) predefinito:

OpenRC

root #rc-update add sshd default

Se è richiesto un accesso da console seriale (che è possibile in caso di server remoti), decommentare la sezione console seriale su /etc/inittab:

Uncomment the serial console section in /etc/inittab:

root #nano -w /etc/inittab
# SERIAL CONSOLES
s0:12345:respawn:/sbin/agetty 9600 ttyS0 vt100
s1:12345:respawn:/sbin/agetty 9600 ttyS1 vt100

systemd

To enable the SSH server, run:

root #systemctl enable sshd

To enable serial console support, run:

root #systemctl enable getty@tty1.service

Optional: Shell completion

Bash

Bash is the default shell for Gentoo systems, and therefore installing completion extensions can aid in efficiency and convenience to managing the system. The app-shells/bash-completion package will install completions available for Gentoo specific commands, as well as many other common commands and utilities:

root #emerge --ask app-shells/bash-completion

Post installation, bash completion for specific commands can managed through eselect. See the Shell completion integrations section of the bash article for more details.

Time synchronization

It is important to use some method of synchronizing the system clock. This is usually done via the NTP protocol and software. Other implementations using the NTP protocol exist, like Chrony.

To set up Chrony, for example:

root #emerge --ask net-misc/chrony

OpenRC

On OpenRC, run:

root #rc-update add chronyd default

systemd

On systemd, run:

root #systemctl enable chronyd.service

Alternatively, systemd users may wish to use the simpler systemd-timesyncd SNTP client which is installed by default.

root #systemctl enable systemd-timesyncd.service

Strumenti per i file system

In base al file system usato, è necessario installare le utilità per file system richieste (per controllare l'integrità dei file system, creare file system aggiuntivi, ecc.). Si noti che gli strumenti per gestire i file system ext2, ext3 o ext4 (sys-fs/e2fsprogs) sono già installati come parte del @system set.

La seguente tabella elenca gli strumenti da installare in relazione al file system usato:

Filesystem Package
Ext2, 3, e 4 sys-fs/e2fsprogs
XFS sys-fs/xfsprogs
ReiserFS sys-fs/reiserfsprogs
JFS sys-fs/jfsutils
VFAT (FAT32, ...) sys-fs/dosfstools
Btrfs sys-fs/btrfs-progs

It's recommended that sys-block/io-scheduler-udev-rules is installed for the correct scheduler behavior with e.g. nvme devices:

root #emerge --ask sys-block/io-scheduler-udev-rules
Suggerimento
Per maggiori informazioni sui file system in Gentoo vedere l'articolo sui file system.

Strumenti per il lavoro di rete

Se non c'è alcuna necessità di strumenti aggiuntivi per il lavoro di rete, continuare direttamente con la sezione Configurare un bootloader.

Installare un client DHCP

Importante
Sebbene opzionale, la maggior parte degli utenti si serve di un client DHCP per connettersi al server DHCP della propria rete. Si colga ora l'occasione di installare un client DHCP. Se questo passo viene dimenticato, il sistema potrebbe non essere in grado di accedere alla rete rendendo così impossibile scaricare un client DHCP più avanti.

Affinché il sistema ottenga automaticamente un indirizzo IP per una o più interfacce di rete usando gli script netifrc, è necessario installare un client DHCP. Raccomandiamo l'uso di net-misc/dhcpcd sebbene molti altri client DHCP siano disponibili sul deposito (repository) di Gentoo:

root #emerge --ask net-misc/dhcpcd

Opzionale: Installare un client PPPoE

Se PPP è utilizzato per connettersi ad Internet, installare il pacchetto net-dialup/ppp:

root #emerge --ask net-dialup/ppp

Optional: Install wireless networking tools

If the system will be connecting to wireless networks, install the net-wireless/iw package for Open or WEP networks and/or the net-wireless/wpa_supplicant package for WPA or WPA2 networks. iw is also a useful basic diagnostic tool for scanning wireless networks.

root #emerge --ask net-wireless/iw net-wireless/wpa_supplicant

Ora si prosegua con Configurare il bootloader.




Handbook:SPARC/Blocks/Bootloader/it

Riavviare il sistema

Uscire dall'ambiente con la radice cambiata (chroot) e smontare tutte le partizioni montate. Poi si inserisca quell'unico magico comando che avvia il vero test finale: reboot.

root #exit
cdimage ~#cd
cdimage ~#umount -l /mnt/gentoo/dev{/shm,/pts,}
cdimage ~#umount -R /mnt/gentoo
cdimage ~#reboot

Non dimenticare di rimuovere i CD avviabili, altrimenti il CD potrebbe essere avviato al posto del nuovo sistema Gentoo.

Una volta riavviato e giunti nell'ambiente Gentoo appena installato, concludere con Ultimare l'installazione di Gentoo.




Amministrazione utenti

Aggiungere un utente di uso quotidiano

Lavorare come root su un sistema Unix/Linux è pericoloso e dovrebbe essere evitato il più possibile. Perciò è fortemente raccomandato aggiungere un utente per un utilizzo quotidiano.

I gruppi di cui l'utente è membro definiscono quali attività l'utente può compiere. La seguente tabella elenca alcuni importanti gruppi:

Gruppo Descrizione
audio Permette di accedere ai dispositivi audio.
cdrom Permette di accedere direttamente ai dispositivi ottici.
floppy Permette di accedere direttamente ai dispositivi floppy.
games Permette di eseguire i giochi.
portage Permette di accedere alle risorse soggette a restrizioni di portage.
usb Permette di accedere ai dispositivi USB.
video Permette di accedere all'hardware per la cattura dei video e di usare l'accelerazione hardware.
wheel Permette di usare il comando su.

Per esempio, per creare un utente chiamato larry che sia membro dei gruppi wheel, users e audio, prima accedere come root (solo root può creare utenti), poi eseguire useradd:

Login:root
Password: (Inserire la password di root)

When setting passwords for standard user accounts, it is good security practice to avoid using the same or a similar password as set for the root user.

Handbook authors recommended to use a password at least 16 characters in length, with a value fully unique from every other user on the system.

root #useradd -m -G users,wheel,audio -s /bin/bash larry
root #passwd larry
Password: (Inserire la password per larry)
Re-enter password: (Reinserire la password per conferma)

Se un utente dovesse eseguire qualche attività come root, allora può usare su - per ricevere temporaneamente i privilegi di root. Un altro modo è usare il pacchetto sudo che è, se correttamente configurato, molto sicuro.

Pulizia del disco

Rimuovere i tarball

Con l'installazione di Gentoo conclusa ed il sistema riavviato, se ogni cosa è andata bene, possiamo rimuovere dal disco rigido il tarball stage3 scaricato. La cartella in cui vengono scaricati è /.

The files are located in the / directory and can be removed with the following command:

root #rm /stage3-*.tar.bz2*

Come proseguire da qui

Dove proseguire da qui? Quali opzioni si presentano adesso? Cosa esplorare inizialmente? Gentoo fornisce ai suoi utenti molte possibilità, e perciò molte caratteristiche documentate (e meno documentate).

Documentazione

It is important to note that, due to the number of choices available in Gentoo, the documentation provided by the handbook is limited in scope - it mainly focuses on the basics of getting a Gentoo system up and running and basic system management activities. The handbook intentionally excludes instructions on graphical environments, details on hardening, and other important administrative tasks. That being stated, there are more sections of the handbook to assist readers with more basic functions.

Decisamente è il caso di dare un'occhiata alla prossima parte del Manuale di Gentoo intitolata Lavorare con Gentoo che spiega come tenere il software aggiornato, come installare più software, cosa sono le USE flag (bandiere, opzioni), come l'init del sistema Gentoo funziona, ecc.

Oltre al manuale, ci si deve sentire incoraggiati ad esplorare altri angoli del Wiki di Gentoo per trovare documentazione aggiuntiva e fornita dalla comunità. La squadra wiki di Gentoo offre anche una Panoramica degli argomenti della documentazione che elenca una buona selezione di articoli presenti proprio sul wiki. Per esempio, si fa riferimento alla Guida per la localizzazione affinché il sistema ci faccia sentire più a nostro agio.

The majority of users with desktop use cases will setup graphical environments in which to work natively. There are many community maintained 'meta' articles for supported desktop environments (DEs) and window managers (WMs). Readers should be aware that each DE will require slightly different setup steps, which will lengthen add complexity to bootstrapping.

Many other Meta articles exist to provide our readers with high level overviews of available software within Gentoo.

Gentoo online

Importante
Readers should note that all official Gentoo sites online are governed by Gentoo's code of conduct. Being active in the Gentoo community is a privilege, not a right, and users should be aware that the code of conduct exists for a reason.

With the exception of the Libera.Chat hosted internet relay chat (IRC) network and the mailing lists, most Gentoo websites require an account on a per site basis in order to ask questions, open a discussion, or enter a bug.

Forums and IRC

Ognuno è certamente il benvenuto sui nostri forum Gentoo o su uno dei nostri tanti canali Gentoo IRC.

Mailing lists

Abbiamo anche numerose mailing list (liste email) aperte a tutti i nostri utenti. Informazioni su come unirsi sono presenti in quella pagina.

Bugs

Sometimes after reviewing the wiki, searching the forums, and seeking support in the IRC channel or mailing lists there is no known solution to a problem. Generally this is a sign to open a bug on Gentoo's Bugzilla site.

Development guide

Readers who desire to learn more about developing Gentoo can take a look at the Development guide. This guide provides instructions on writing ebuilds, working with eclasses, and provides definitions for many general concepts behind Gentoo development.

Closing thoughts

Divertiti con la tua installazione!

As a reminder, any feedback for this handbook should follow the guidelines detailed in the How do I improve the Handbook? section at the beginning of the handbook.

We look forward to seeing how our users will choose to implement Gentoo to fit their unique use cases and needs.