SlideShare une entreprise Scribd logo
1  sur  24
Télécharger pour lire hors ligne
Cobbler: Quando Linux
installa Linux
e ti fa le scarpe!



Stefano Frontori
Associazione di Promozione Sociale LOLUG – Gruppo Utenti Linux Lodi
stefano.frontori@lolug.org
Spesso accade che...

devo (re)installare il sistema operativo:

●   Che noia, ma quanto ci mette?

●   non trovo più il CD... (e se il lettore non cè?)

●   mi sono sbagliato, lo devo reinstallare?

●   ma come lo avevo configurato?


Stefano Frontori        PILLOle: Cobbler               2
Cobbler

●   Ufficialmente: “Installation e update server for
    Linux”

●   Un server linux che ci permette di avere un
    ambiente di installazione centralizzato,
    modulare e flessibile.

    ●   basato su pochi e semplici oggetti,
        ●   distro, profili, sistemi, immagini e repository.

    ●   Gestisce macchine fisiche e virtuali


Stefano Frontori                  PILLOle: Cobbler             3
Installazione & config


    [root@ariel ~]# yum -y install cobbler
    koan tftp-server dhcp httpd bind

    [root@ariel ~]# cobbler check
    ....

    [root@ariel ~]# vim /etc/cobbler/settings

    [root@ariel ~]# service cobblerd restart




Stefano Frontori    PILLOle: Cobbler            4
Una semplice procedura


 [root@ariel ~]# cobbler import
 --mirror=/media/cdrom/
 --name=Fedora-10-i386



 [root@ariel ~]# cobbler list
 disto Fedora-10-i386
    profile Fedora-10-i386
    profile rescue-Fedora-10-i386



Stefano Frontori   PILLOle: Cobbler   5
Le Distribuzioni

  cobbler distro add --name=string
 --kernel=path --initrd=path



●   Kernel = software avente il compito di fornire
    ai processi in esecuzione sull'elaboratore un
    accesso sicuro e controllato all'hardware.

●   Initrd = "initial ramdisk", ed è un piccolo
    filesystem montato in memoria da Linux nella
    fase iniziale della procedura di boot
Stefano Frontori      PILLOle: Cobbler               6
Object tree

        kernel
                   Distro
        initrd
                                            Repo
                                               Data mirror
      kickstart
                   Profili

                                          Immagini
                                                   Binary
     interfacce
                   Sistemi



Stefano Frontori       PILLOle: Cobbler                     7
Aggiungere un profilo

 [root@ariel ~]# cobbler profile add
 --name=myWebServer-Fedora-10
 --distro=Fedora10-i386
 --kickstart=/path/my-WebServer-kickstart.ks



●   Ogni profilo è caratterizzato da un file di
    kickstart

●   Ad ogni distro possono essere associati uno
    o più profili
Stefano Frontori        PILLOle: Cobbler          8
I profili
●   Sono l'associazione tra una distribuzione e un
    file di kickstart


  cobbler profile add --name=string
 --distro=string [--kickstart=path]



●   Un profilo specializza la configurazione di una
    tipologia di macchine
    ●   web server, mail, ftp, desktop...


Stefano Frontori            PILLOle: Cobbler          9
I file di kickstart
    #platform=x86, AMD64, or Intel EM64T
    # System authorization information
    auth --useshadow --enablemd5
    # System bootloader configuration
    bootloader --location=mbr
    # Partition clearing information
    clearpart --all --initlabel
    # Use text mode install
    text
    # Firewall configuration
    firewall --disabled
    # Run the Setup Agent on first boot
    firstboot --disable
    # System keyboard
    keyboard it
    # System language
    lang en_US
    # Use network installation
    url --url=$tree
    # If any cobbler repo definitions were referenced in the kickstart
    $yum_repo_stanza
    # Network information
    $SNIPPET('network_config')
    # Reboot after installation
    reboot


Stefano Frontori                PILLOle: Cobbler                         10
Object tree

        kernel
                   Distro
        initrd
                                            Repo
                                               Data mirror
      kickstart
                   Profili

                                          Immagini
                                                   Binary
     interfacce
                   Sistemi



Stefano Frontori       PILLOle: Cobbler                     11
Aggiungere un sistema
 [root@ariel ~]# cobbler system add
 --name=myDesktop
 --profile=myDesktop-Fedora-10
 --interface=eth0
 --ip=192.168.0.50
 --mac=AA:BB:CC:DD:EE:A1


●   Da un profilo possiamo creare un sistema
    semplicemente associandogli un interfaccia di
    rete.
    ●   un pezzo di hardware indentificaco da un mac
        address

Stefano Frontori          PILLOle: Cobbler             12
I sistemi

 cobbler system add --name=string
 --profile=string [--mac=macaddress]




●   Cobbler gestisce le interfacce attraverso gli
    snippets
    ● pre_install_network_config
    ● post_install_network_config



    contenuti nel file di kickstart associato al
    sistema
Stefano Frontori        PILLOle: Cobbler            13
Snippets
●   Gli snippets rendono dinamico (!) un file di
    kickstart
    %pre
    $kickstart_start
    $SNIPPET('pre_install_network_config')

    %packages
    $SNIPPET('func_install_if_enabled')

    %post
    # Start yum configuration
    $yum_config_stanza
    # End yum configuration
    $SNIPPET('post_install_kernel_options')
    $SNIPPET('post_install_network_config')
    $SNIPPET('func_register_if_enabled')
    $SNIPPET('download_config_files')
    # Enable post-install boot notification
    $SNIPPET('post_anamon')
    # Start final steps
    $kickstart_done



Stefano Frontori                PILLOle: Cobbler   14
Object tree

        kernel
                   Distro
        initrd
                                            Repo
                                               Data mirror
      kickstart
                   Profili

                                          Immagini
                                                   Binary
     interfacce
                   Sistemi



Stefano Frontori       PILLOle: Cobbler                     15
Repository e Immagini


 [root@ariel ~]# cobbler repo add
 --mirror=http://mirrors.kernel.org/fedora-10/
 --name=Fedora10-i386-updates




 [root@ariel ~]# cobbler image add
 --name=Fedora-10-LIVE
 --file=/path/Fedora-10-LIVE.iso
 --image-type=iso


Stefano Frontori   PILLOle: Cobbler          16
Provisioning

Abbiamo aggiunto tutto quello che ci serve, ora
come lo installiamo?

●   Cobbler supporta l'installazione via rete
    tramite PXE (preboot execution enviroment)

●   anche la gestione di servizi dhcp e di bind

 [root@ariel ~]# vim /etc/cobbler/dhcp.template
 [root@ariel ~]# service dhcpd start
 [root@ariel ~]# service xinetd start


Stefano Frontori       PILLOle: Cobbler           17
Provisioning
●   Ogni volta che si aggiunge o crea un
    elemento è necessario riavviare tutti i servizi
    utilizzati

 [root@ariel ~]# cobbler sync



●   È anche possibile fare provisionig alla vecchia
    maniera, a mano ;-)

 [root@ariel ~]# cobbler buildiso


Stefano Frontori       PILLOle: Cobbler               18
Virtualizzare
E se avessi la necessità di macchine virtuali?

●   Koan (kickstart over a network) gestisce il
    processo di installazione su di una macchina

    ●   virtuale (Xen, Kvm/Qemu, VmWare)
    ●   dove non è possibile utilizzare PXE
    ●   per reinstallare un sistema già esistente


 [root@ariel ~]# koan --server=myCobblerServer
 --replace-self --system=myVirtual-WebServer


Stefano Frontori           PILLOle: Cobbler         19
Cobbler web interface




Stefano Frontori   PILLOle: Cobbler   20
Api & Xmlrpc
●   Cobbler mette a disposiozione delle comode
    api per accedere alle funzionalità del server

#!/usr/bin/env python

from cobbler import api as cobbler_api
cobbler_api = cobbler_api.BootAPI()

import xmlrpclib

    my_uri = "http://192.168.0.1/cobbler_api_rw"
    remote = xmlrpclib.Server(my_uri)
# now add a profile
   pro_id = remote.new_profile(token)
   remote.modify_profile(pro_id, 'name', profilename, token)
   remote.modify_profile(pro_id, 'distro', distroname, token)
   remote.modify_profile(pro_id, 'kickstart', kslink, token)

    status = remote.save_profile(pro_id,token)



Stefano Frontori               PILLOle: Cobbler                 21
Useful Command
●   È possibile importare in cobbler anche sistemi
    non unix-like
 [root@ariel ~]# cobbler image add
 --name=WindowsXP
 --filename=WindowsXP.iso

●   È anche possibile fare il provisioning di
    distribuzioni Live!

 [root@ariel ~]# koan --server=myCobblerServer
 --virt --virt-name=Fedora-9-LIVECD
 -C --image=Fedora-9-LiveCD

Stefano Frontori       PILLOle: Cobbler              22
Domande?



Stefano Frontori     PILLOle: Cobbler   23
Riferimenti

●   Main Site:
    https://fedorahosted.org/cobbler/

    ●   User Documentation
        ●   https://fedorahosted.org/cobbler/wiki/UserDocs

    ●   Developer Documentation
        ●   https://fedorahosted.org/cobbler/wiki/DeveloperDocs




Stefano Frontori                PILLOle: Cobbler                  24

Contenu connexe

Tendances

Raspberry omv
Raspberry omvRaspberry omv
Raspberry omv
Pipperss
 
Introduzione Alla Uml Mconsole
Introduzione Alla Uml MconsoleIntroduzione Alla Uml Mconsole
Introduzione Alla Uml Mconsole
Majong DevJfu
 
From Scratch To Network - User mode linux
From Scratch To Network - User mode linuxFrom Scratch To Network - User mode linux
From Scratch To Network - User mode linux
Majong DevJfu
 
Sottoli in the cloud
Sottoli in the cloudSottoli in the cloud
Sottoli in the cloud
dema
 
Lezione corso Base GNU/Linux
Lezione corso Base GNU/LinuxLezione corso Base GNU/Linux
Lezione corso Base GNU/Linux
Alex Palesandro
 

Tendances (11)

Raspberry omv
Raspberry omvRaspberry omv
Raspberry omv
 
Cuma rev001
Cuma rev001Cuma rev001
Cuma rev001
 
Command Terminal Linux
Command Terminal LinuxCommand Terminal Linux
Command Terminal Linux
 
Introduzione Alla Uml Mconsole
Introduzione Alla Uml MconsoleIntroduzione Alla Uml Mconsole
Introduzione Alla Uml Mconsole
 
From Scratch To Network - User mode linux
From Scratch To Network - User mode linuxFrom Scratch To Network - User mode linux
From Scratch To Network - User mode linux
 
Introduzione al Cloud - Progetto ICARO
Introduzione al Cloud - Progetto ICAROIntroduzione al Cloud - Progetto ICARO
Introduzione al Cloud - Progetto ICARO
 
Sottoli in the cloud
Sottoli in the cloudSottoli in the cloud
Sottoli in the cloud
 
Shell unix
Shell unixShell unix
Shell unix
 
ArduinoDay17 - Creazione di un piccolo supercomputer con Raspberry PI per cal...
ArduinoDay17 - Creazione di un piccolo supercomputer con Raspberry PI per cal...ArduinoDay17 - Creazione di un piccolo supercomputer con Raspberry PI per cal...
ArduinoDay17 - Creazione di un piccolo supercomputer con Raspberry PI per cal...
 
Lezione corso Base GNU/Linux
Lezione corso Base GNU/LinuxLezione corso Base GNU/Linux
Lezione corso Base GNU/Linux
 
Installare i server via rete con Cobbler
Installare i server via rete con CobblerInstallare i server via rete con Cobbler
Installare i server via rete con Cobbler
 

Similaire à Sfrontori pillole-cobbler

PIT2012: Workshop@UniNA - Compilazione del Kernel Linux
PIT2012: Workshop@UniNA - Compilazione del Kernel LinuxPIT2012: Workshop@UniNA - Compilazione del Kernel Linux
PIT2012: Workshop@UniNA - Compilazione del Kernel Linux
Marco Ferrigno
 

Similaire à Sfrontori pillole-cobbler (20)

Idp, passo dopo passo!
Idp, passo dopo passo!Idp, passo dopo passo!
Idp, passo dopo passo!
 
Compilazione Kernel
Compilazione KernelCompilazione Kernel
Compilazione Kernel
 
Livin' with Docker - dallo sviluppo alla produzione
Livin' with Docker - dallo sviluppo alla produzioneLivin' with Docker - dallo sviluppo alla produzione
Livin' with Docker - dallo sviluppo alla produzione
 
Seminario Raspberri Pi - Parte 2 - GULP
Seminario Raspberri Pi - Parte 2 - GULPSeminario Raspberri Pi - Parte 2 - GULP
Seminario Raspberri Pi - Parte 2 - GULP
 
PIT2012: Workshop@UniNA - Compilazione del Kernel Linux
PIT2012: Workshop@UniNA - Compilazione del Kernel LinuxPIT2012: Workshop@UniNA - Compilazione del Kernel Linux
PIT2012: Workshop@UniNA - Compilazione del Kernel Linux
 
TuxIsAlive
TuxIsAliveTuxIsAlive
TuxIsAlive
 
Slax su pendrive
Slax su pendriveSlax su pendrive
Slax su pendrive
 
Sviluppo Code-driven e riusabilità del codice: CMI e Features per D8
Sviluppo Code-driven e riusabilità del codice: CMI e Features per D8Sviluppo Code-driven e riusabilità del codice: CMI e Features per D8
Sviluppo Code-driven e riusabilità del codice: CMI e Features per D8
 
Sviluppo Code-driven e riusabilità del codice: CMI e Features per D8
Sviluppo Code-driven e riusabilità del codice: CMI e Features per D8Sviluppo Code-driven e riusabilità del codice: CMI e Features per D8
Sviluppo Code-driven e riusabilità del codice: CMI e Features per D8
 
Richiami su Linux - Webmin - Reti di calcolatori
Richiami su Linux - Webmin - Reti di calcolatoriRichiami su Linux - Webmin - Reti di calcolatori
Richiami su Linux - Webmin - Reti di calcolatori
 
Il dual boot scolastico perfetto (2012)
Il dual boot scolastico perfetto (2012)Il dual boot scolastico perfetto (2012)
Il dual boot scolastico perfetto (2012)
 
Vagrant e Docker a confronto;scegliere ed iniziare
Vagrant e  Docker a confronto;scegliere ed iniziareVagrant e  Docker a confronto;scegliere ed iniziare
Vagrant e Docker a confronto;scegliere ed iniziare
 
Raspberry pi per tutti (workshop presso Warehouse Coworking Pesaro)
Raspberry pi per tutti (workshop presso Warehouse Coworking Pesaro)Raspberry pi per tutti (workshop presso Warehouse Coworking Pesaro)
Raspberry pi per tutti (workshop presso Warehouse Coworking Pesaro)
 
Con Aruba, a lezione di cloud #lezione 16 - parte 2: 'Centralino VoIP nel cloud'
Con Aruba, a lezione di cloud #lezione 16 - parte 2: 'Centralino VoIP nel cloud'Con Aruba, a lezione di cloud #lezione 16 - parte 2: 'Centralino VoIP nel cloud'
Con Aruba, a lezione di cloud #lezione 16 - parte 2: 'Centralino VoIP nel cloud'
 
Italy vmug 2019 PowerCLI pret-a-porter
Italy vmug 2019 PowerCLI pret-a-porterItaly vmug 2019 PowerCLI pret-a-porter
Italy vmug 2019 PowerCLI pret-a-porter
 
Installazione ambientepython ubuntumate
Installazione ambientepython ubuntumateInstallazione ambientepython ubuntumate
Installazione ambientepython ubuntumate
 
Introduzione ad ubuntu core - Qt day 2017
Introduzione ad ubuntu core  - Qt day 2017Introduzione ad ubuntu core  - Qt day 2017
Introduzione ad ubuntu core - Qt day 2017
 
Linux Kernel, driver e compilazione
Linux Kernel, driver e compilazioneLinux Kernel, driver e compilazione
Linux Kernel, driver e compilazione
 
CodingGym - Lezione 2 - Corso Linux, Android e Internet of Things
CodingGym - Lezione 2 - Corso Linux, Android e Internet of ThingsCodingGym - Lezione 2 - Corso Linux, Android e Internet of Things
CodingGym - Lezione 2 - Corso Linux, Android e Internet of Things
 
High specialized vm on open stack cloud
High specialized vm on open stack cloudHigh specialized vm on open stack cloud
High specialized vm on open stack cloud
 

Sfrontori pillole-cobbler

  • 1. Cobbler: Quando Linux installa Linux e ti fa le scarpe! Stefano Frontori Associazione di Promozione Sociale LOLUG – Gruppo Utenti Linux Lodi stefano.frontori@lolug.org
  • 2. Spesso accade che... devo (re)installare il sistema operativo: ● Che noia, ma quanto ci mette? ● non trovo più il CD... (e se il lettore non cè?) ● mi sono sbagliato, lo devo reinstallare? ● ma come lo avevo configurato? Stefano Frontori PILLOle: Cobbler 2
  • 3. Cobbler ● Ufficialmente: “Installation e update server for Linux” ● Un server linux che ci permette di avere un ambiente di installazione centralizzato, modulare e flessibile. ● basato su pochi e semplici oggetti, ● distro, profili, sistemi, immagini e repository. ● Gestisce macchine fisiche e virtuali Stefano Frontori PILLOle: Cobbler 3
  • 4. Installazione & config [root@ariel ~]# yum -y install cobbler koan tftp-server dhcp httpd bind [root@ariel ~]# cobbler check .... [root@ariel ~]# vim /etc/cobbler/settings [root@ariel ~]# service cobblerd restart Stefano Frontori PILLOle: Cobbler 4
  • 5. Una semplice procedura [root@ariel ~]# cobbler import --mirror=/media/cdrom/ --name=Fedora-10-i386 [root@ariel ~]# cobbler list disto Fedora-10-i386 profile Fedora-10-i386 profile rescue-Fedora-10-i386 Stefano Frontori PILLOle: Cobbler 5
  • 6. Le Distribuzioni cobbler distro add --name=string --kernel=path --initrd=path ● Kernel = software avente il compito di fornire ai processi in esecuzione sull'elaboratore un accesso sicuro e controllato all'hardware. ● Initrd = "initial ramdisk", ed è un piccolo filesystem montato in memoria da Linux nella fase iniziale della procedura di boot Stefano Frontori PILLOle: Cobbler 6
  • 7. Object tree kernel Distro initrd Repo Data mirror kickstart Profili Immagini Binary interfacce Sistemi Stefano Frontori PILLOle: Cobbler 7
  • 8. Aggiungere un profilo [root@ariel ~]# cobbler profile add --name=myWebServer-Fedora-10 --distro=Fedora10-i386 --kickstart=/path/my-WebServer-kickstart.ks ● Ogni profilo è caratterizzato da un file di kickstart ● Ad ogni distro possono essere associati uno o più profili Stefano Frontori PILLOle: Cobbler 8
  • 9. I profili ● Sono l'associazione tra una distribuzione e un file di kickstart cobbler profile add --name=string --distro=string [--kickstart=path] ● Un profilo specializza la configurazione di una tipologia di macchine ● web server, mail, ftp, desktop... Stefano Frontori PILLOle: Cobbler 9
  • 10. I file di kickstart #platform=x86, AMD64, or Intel EM64T # System authorization information auth --useshadow --enablemd5 # System bootloader configuration bootloader --location=mbr # Partition clearing information clearpart --all --initlabel # Use text mode install text # Firewall configuration firewall --disabled # Run the Setup Agent on first boot firstboot --disable # System keyboard keyboard it # System language lang en_US # Use network installation url --url=$tree # If any cobbler repo definitions were referenced in the kickstart $yum_repo_stanza # Network information $SNIPPET('network_config') # Reboot after installation reboot Stefano Frontori PILLOle: Cobbler 10
  • 11. Object tree kernel Distro initrd Repo Data mirror kickstart Profili Immagini Binary interfacce Sistemi Stefano Frontori PILLOle: Cobbler 11
  • 12. Aggiungere un sistema [root@ariel ~]# cobbler system add --name=myDesktop --profile=myDesktop-Fedora-10 --interface=eth0 --ip=192.168.0.50 --mac=AA:BB:CC:DD:EE:A1 ● Da un profilo possiamo creare un sistema semplicemente associandogli un interfaccia di rete. ● un pezzo di hardware indentificaco da un mac address Stefano Frontori PILLOle: Cobbler 12
  • 13. I sistemi cobbler system add --name=string --profile=string [--mac=macaddress] ● Cobbler gestisce le interfacce attraverso gli snippets ● pre_install_network_config ● post_install_network_config contenuti nel file di kickstart associato al sistema Stefano Frontori PILLOle: Cobbler 13
  • 14. Snippets ● Gli snippets rendono dinamico (!) un file di kickstart %pre $kickstart_start $SNIPPET('pre_install_network_config') %packages $SNIPPET('func_install_if_enabled') %post # Start yum configuration $yum_config_stanza # End yum configuration $SNIPPET('post_install_kernel_options') $SNIPPET('post_install_network_config') $SNIPPET('func_register_if_enabled') $SNIPPET('download_config_files') # Enable post-install boot notification $SNIPPET('post_anamon') # Start final steps $kickstart_done Stefano Frontori PILLOle: Cobbler 14
  • 15. Object tree kernel Distro initrd Repo Data mirror kickstart Profili Immagini Binary interfacce Sistemi Stefano Frontori PILLOle: Cobbler 15
  • 16. Repository e Immagini [root@ariel ~]# cobbler repo add --mirror=http://mirrors.kernel.org/fedora-10/ --name=Fedora10-i386-updates [root@ariel ~]# cobbler image add --name=Fedora-10-LIVE --file=/path/Fedora-10-LIVE.iso --image-type=iso Stefano Frontori PILLOle: Cobbler 16
  • 17. Provisioning Abbiamo aggiunto tutto quello che ci serve, ora come lo installiamo? ● Cobbler supporta l'installazione via rete tramite PXE (preboot execution enviroment) ● anche la gestione di servizi dhcp e di bind [root@ariel ~]# vim /etc/cobbler/dhcp.template [root@ariel ~]# service dhcpd start [root@ariel ~]# service xinetd start Stefano Frontori PILLOle: Cobbler 17
  • 18. Provisioning ● Ogni volta che si aggiunge o crea un elemento è necessario riavviare tutti i servizi utilizzati [root@ariel ~]# cobbler sync ● È anche possibile fare provisionig alla vecchia maniera, a mano ;-) [root@ariel ~]# cobbler buildiso Stefano Frontori PILLOle: Cobbler 18
  • 19. Virtualizzare E se avessi la necessità di macchine virtuali? ● Koan (kickstart over a network) gestisce il processo di installazione su di una macchina ● virtuale (Xen, Kvm/Qemu, VmWare) ● dove non è possibile utilizzare PXE ● per reinstallare un sistema già esistente [root@ariel ~]# koan --server=myCobblerServer --replace-self --system=myVirtual-WebServer Stefano Frontori PILLOle: Cobbler 19
  • 20. Cobbler web interface Stefano Frontori PILLOle: Cobbler 20
  • 21. Api & Xmlrpc ● Cobbler mette a disposiozione delle comode api per accedere alle funzionalità del server #!/usr/bin/env python from cobbler import api as cobbler_api cobbler_api = cobbler_api.BootAPI() import xmlrpclib my_uri = "http://192.168.0.1/cobbler_api_rw" remote = xmlrpclib.Server(my_uri) # now add a profile pro_id = remote.new_profile(token) remote.modify_profile(pro_id, 'name', profilename, token) remote.modify_profile(pro_id, 'distro', distroname, token) remote.modify_profile(pro_id, 'kickstart', kslink, token) status = remote.save_profile(pro_id,token) Stefano Frontori PILLOle: Cobbler 21
  • 22. Useful Command ● È possibile importare in cobbler anche sistemi non unix-like [root@ariel ~]# cobbler image add --name=WindowsXP --filename=WindowsXP.iso ● È anche possibile fare il provisioning di distribuzioni Live! [root@ariel ~]# koan --server=myCobblerServer --virt --virt-name=Fedora-9-LIVECD -C --image=Fedora-9-LiveCD Stefano Frontori PILLOle: Cobbler 22
  • 23. Domande? Stefano Frontori PILLOle: Cobbler 23
  • 24. Riferimenti ● Main Site: https://fedorahosted.org/cobbler/ ● User Documentation ● https://fedorahosted.org/cobbler/wiki/UserDocs ● Developer Documentation ● https://fedorahosted.org/cobbler/wiki/DeveloperDocs Stefano Frontori PILLOle: Cobbler 24