42
Einleitung PXE AutoYaST Kickstart Preseed Linux Autoinstallation UnFUG Azidburn, Luke, Spyk 21. Oktober 2010 1 / 37

Linux Auto Install

  • Upload
    kallies

  • View
    250

  • Download
    6

Embed Size (px)

Citation preview

Page 1: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Linux Autoinstallation

UnFUG

Azidburn, Luke, Spyk

21. Oktober 2010

1 / 37

Page 2: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Gliederung

1 Einleitung

2 PXE

3 AutoYaST

4 Kickstart

5 Preseed

2 / 37

Page 3: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Gliederung

1 Einleitung

2 PXE

3 AutoYaST

4 Kickstart

5 Preseed

2 / 37

Page 4: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Gliederung

1 Einleitung

2 PXE

3 AutoYaST

4 Kickstart

5 Preseed

2 / 37

Page 5: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Gliederung

1 Einleitung

2 PXE

3 AutoYaST

4 Kickstart

5 Preseed

2 / 37

Page 6: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Gliederung

1 Einleitung

2 PXE

3 AutoYaST

4 Kickstart

5 Preseed

2 / 37

Page 7: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Warum das ganze?

”Using kickstart[, AutoYaST or Preseeding], a system administrator

can create a single file containing the answers to all the questionsthat would normally be asked during a typical installation.“ [Fed]

Identische Installationen erzeugen

Wiederkehrende Aufgaben automatisieren

Post-Installationsaufwand minimieren

3 / 37

Page 8: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

PXE

PXE = Preboot eXecution Environment

Entwickelt von Intel

Aktuelle Version 2.1xx

Booten ubers Netzwerk

PXE Environment auf dem Boot-ROM der Netzwerkkarten

PXE-Linux ist Teil des Syslinux Paket

Benotigt normalerweise DHCP + TFTP + pxelinux.0 +Konfig-File

PXE normalerweise nur textbasierend, aber man es auch einbischen graphischer machen :)

4 / 37

Page 9: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

PXE-Struktur

<filename root>/

pxelinux.0

pxelinux.cfg/

default

0123456789abcd

5 / 37

Page 10: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

PXE-Menu

1 DEFAULT p x e l i n u x . msc/vesamenu . c322 PROMPT 03 TIMEOUT 30004 MENU TITLE IN I n s t a l l a t i o n s Boot Menu5 INCLUDE p x e l i n u x . msc/ d e s i g n67 LABEL deb ian8 menu PASSWD $1$u3RDhzxa$8Ng09KyCV30rkgyoKhOjQ69 menu l a b e l ˆWin−Pool I n s t a l l

10 k e r n e l ubuntu−i n s t a l l e r / i 386 / l i n u x11 append vga=normal i n i t r d=ubuntu−i n s t a l l e r / i 386 / i n i t r d . gz auto=t r u e p r i o r i t y=

c r i t i c a l p r e s e ed / u r l=ht tp : / /141 . 2 8 . 6 4 . 1 93/ p r e s e ed /winws10 . c f g −−1213 LABEL r e s c u e14 MENU LABEL Rescue Too l s15 KERNEL p x e l i n u x . msc/vesamenu . c3216 APPEND r e s c u e / p x e l i n u x . c f g / d e f a u l t

6 / 37

Page 11: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

VESA PXE-Menu

7 / 37

Page 12: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

AutoYaST

Seit Suse 7.3

XML

XML lasst ich aus einer Referenzinstallation generieren

8 / 37

Page 13: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

AutoYaST Konfiguration

9 / 37

Page 14: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Referenz-XML-File erstellen

10 / 37

Page 15: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Skripte

Vorinstallationsskripte

Postinstallationsskripte

Chroot-Skripte

Init-Skripte

Post-Partionierungs-Skripte

11 / 37

Page 16: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Skripte

Shell

Perl

Python

12 / 37

Page 17: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

1 <? xml v e r s i o n="1.0"?>2 <!DOCTYPE p r o f i l e>3 <p r o f i l e xmlns="http://www.suse.com /1.0/ yast2ns" xm l n s : c o n f i g="http://www.suse.

com /1.0/ configns">4 <dep l oy image>5 < i m a g e i n s t a l l a t i o n c o n f i g : t y p e="boolean">f a l s e</ i m a g e i n s t a l l a t i o n>6 </ dep l oy image>7 <s c r i p t s>8 <pre−s c r i p t s c o n f i g : t y p e="list">9 <s c r i p t>

10 <debug c o n f i g : t y p e="boolean">t r u e</debug>11 <f e edback c o n f i g : t y p e="boolean">f a l s e</ f eedback>12 <f e e dba c k t y p e></ f e e dba c k t y p e>13 <f i l e n ame>Pre−S c r i p t</ f i l e n ame>14 < i n t e r p r e t e r>s h e l l</ i n t e r p r e t e r>15 <l o c a t i o n><! [CDATA[ ] ]></ l o c a t i o n>16 <n o t i f i c a t i o n>Pre−S c r i p t</ n o t i f i c a t i o n>17 <s ou r c e><! [CDATA[#!/ b in / sh1819 echo ” Ha l l o ” ] ]></ sou r c e>20 </ s c r i p t>21 </pre−s c r i p t s>22 </ s c r i p t s>23 </ p r o f i l e>

13 / 37

Page 18: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Autoyast starten

local

... autoyast=autoyast.xml

nfs

... autoyast=nfs://ip/autoyast.xml

14 / 37

Page 19: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Autoyast starten

local

... autoyast=autoyast.xml

nfs

... autoyast=nfs://ip/autoyast.xml

14 / 37

Page 20: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Kickstart

Welche Distributionen werden unterstutzt?

Red Hat EL

CentOS

Fedora

Scientific Linux

. . .

15 / 37

Page 21: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Installationswege

Von welchen Medien kann installiert werden?

Startmedien

Floppy

CD/DVD

HDD/USB-HDD

PXE

Config-Medien

Floppy

CD/DVD

HDD/USB-HDD

NFS

(FTP)

HTTP

16 / 37

Page 22: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Planung und Vorgehen

1 Konfiguration erstellen

/root/anaconda-ks.cfg einer vorhandenen Installation/usr/sbin/system-config-kickstart

from scratch oder anhand von Beispielen

2 Bootmedium erstellen und kickstart-Datei (z.B. ks.cfg)verfugbar machen

3 Installationsbaum erstellen (bzw. einen vorhanden benutzen)

http://141.28.78.100/mirrors/centos/VERS/os/ARCH/

CD/DVD verwenden bzw. kopierenggf. (zusatzlich) createrepo

4 Testen

17 / 37

Page 23: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

/root/anaconda-ks.cfg

1 # K i c k s t a r t f i l e a u t oma t i c a l l y g ene r a t ed by anaconda .23 i n s t a l l4 cdrom5 l ang en US .UTF−86 keyboard de7 network −−d e v i c e eth0 −−boo tp ro to s t a t i c −−i p 1 0 . 1 0 . 1 0 . 3 −−netmask 255 . 255 . 255 . 0

−−gateway −−hostname unfug8 rootpw −−i s c r y p t e d $1$gkfMxYUL$5B06vvqfo3V . QwrkWBIKy19 f i r e w a l l −−enab l ed −−po r t =22: tcp

10 au t h c on f i g −−enab leshadow −−enablemd511 s e l i n u x −−e n f o r c i n g12 t imezone −−utc Europe / B e r l i n13 boo t l o a d e r −−l o c a t i o n=mbr −−d r i v e o r d e r=sda14 # The f o l l o w i n g i s the p a r t i t i o n i n f o rma t i o n you r e qu e s t e d15 #. . .16 #c l e a r p a r t −−a l l −−d r i v e s=sda17 #pa r t / boot −−f s t y p e ex t3 −−s i z e =100 −−ond i s k=sda18 #pa r t pv . 2 −−s i z e=0 −−grow −−ond i s k=sda19 #vo l g r oup VolGroup00 −−p e s i z e =32768 pv . 220 #l o g v o l swap −−f s t y p e swap −−name=LogVol01 −−vgname=VolGroup00 −−s i z e =384 −−grow

−−maxs i ze=76821 #l o g v o l / −−f s t y p e ex t3 −−name=LogVol00 −−vgname=VolGroup00 −−s i z e =1024 −−grow2223 %packages24 @base25 vim

18 / 37

Page 24: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

system-config-kickstart

19 / 37

Page 25: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Sections

%pre

Am Ende der ks-Datei (srsly[Fed])Netzwerk (ohne Namensauflosung) verfugbarInterpreter normalerweise /bin/sh, andere moglich

%post

Alles was nach der Installation zu erledigen istBenutzer anlegenKonfigurationen anpassenSSH-Keys hinterlegenLogging via %post --log=/root/my-post-log

Lauft in einer chroot-Umgebung (/mnt/sysimage)

%packages

Pakete (vim, emacs, . . . )Paketgruppen (@java-development, @base, . . . )

20 / 37

Page 26: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Installation

linux ...

ks

versucht, Pfad zur ks-Datei via DHCP zu bekommenalternativnfs:DHCPServer:/kickstart/CLIENTIP-kickstart

ks=floppy

ks=floppy:/<path>

ks=cdrom:/<path>

ks=hd:<device>:/<file>

ks=file:/<file> (ohne Mountversuch)

ks=nfs:<server>:/<path>

ks=http://<server>/<path>

21 / 37

Page 27: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Exkurs Remastering

boot.iso von Installations-Medium bzw. -Mirror im Pfadimages loopback-mounten

Installationsbaum kopieren

isolinux/isolinux.cfg anpassen

Image mit mkisofs erstellen 1

mkisofs -R -J -T -no-emul-boot -boot-load-size 4

-boot-info-table -V ’UnFUG Kickstarter’ -b

isolinux/isolinux.bin -c isolinux/boot.cat -o

unfug.iso PATHTOINSTALLTREE

1http://www.hs-furtwangen.de/~kalliesl/documents/unfug_

kickstart-demo_centos5.iso22 / 37

Page 28: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

linux ks=cdrom:/ks.cfg

23 / 37

Page 29: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Tipps & Tricks

Installation via VNC uberwachen

vnc in der ks-Datei startet fur die (grafische) Installationeinen VNC-Server [Hat, Kapitel 28.10.].

vncconnect=<host>[:<port>] verbindet sich zu einemVNC-Client (listening-mode).

vncpassword=<password> gibt ein (optionales) Passwort furdie Verbindung vor.

24 / 37

Page 30: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Tipps & Tricks

TTYs

Alt-F1 Installationsdialog im Textmodus

Alt-F2 Shell-Promt

Alt-F3 Installationslog

Alt-F4 Systemlog

Alt-F5 Alle anderen Meldungen

Alt-F7 Installationsdialog im grafischen Modus

[Cen]

25 / 37

Page 31: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Preseed

Textfile

Eintrage nach dem Schema “<Paket> <schlussel> <typ>

<Wert>”

Welche Distributionen werden unterstutzt?

Debian

(X)ubuntu

. . .

26 / 37

Page 32: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Installation

Installation method initrd file networkCD/DVD yes yes yes

netboot yes no yes

HDD,USB etc yes yes yes

Config lokal

.. preseed/file=<file>

Configs ubers Netz

.. preseed/url=http://<url>

.. preseed/url=ftp://<url>

27 / 37

Page 33: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Erstellen von Preseed-Dateien

handisch

Lieblings Text-Editor nutzen und Preseed-Datei editieren

debconf

1 Debian installieren

2 debconf-get-selection --install > file

3 debconf-get-selection > file2

4 Dateien mergen und editieren

28 / 37

Page 34: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Lokalisierung

1 d−i deb ian−i n s t a l l e r / l o c a l e s t r i n g de DE2 d−i c on so l e−t o o l s / a r ch s s t r i n g at3 d−i c on so l e−keymaps−at /keymap s e l e c t de−l a t i n 1−nodeadkeys4 d−i c on so l e−s e tup / a s k d e t e c t boo l ean t r u e5 d−i c on so l e−s e tup /modelcode s t r i n g pc1056 d−i c on so l e−s e tup / l a you t code s t r i n g de7 d−i c on so l e−s e tup / l a y o u t s e l e c t Germany

29 / 37

Page 35: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Netwerkkonfiguration

1 d−i n e t c f g / c h o o s e i n t e r f a c e s e l e c t eth02 d−i n e t c f g / dhcp t imeout s t r i n g 13 d−i n e t c f g / d i s a b l e d h c p boo l ean t r u e4 d−i n e t c f g / d h c p f a i l e d note5 d−i n e t c f g / dhcp op t i o n s s e l e c t Con f i g u r e network manua l l y6 d−i n e t c f g / g e t n ame s e r v e r s s t r i n g 1 41 . 2 8 . 2 . 1 97 d−i n e t c f g / get ne tmask s t r i n g 255 . 255 . 255 . 08 d−i n e t c f g / ge t ga teway s t r i n g 213 . 95 . 27 . 1 389 d−i n e t c f g / c o n f i r m s t a t i c boo l ean t r u e

10 d−i n e t c f g / get domain s t r i n g unfug . org1112 d−i c l o ck−s e tup / utc boo l ean f a l s e13 d−i t ime / zone s t r i n g Europe / B e r l i n14 d−i c l o ck−s e tup / ntp boo l ean t r u e15 d−i c l o ck−s e tup /ntp−s e r v e r s t r i n g 141 . 2 8 . 7 8 . 8 0

30 / 37

Page 36: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Paketquellen

1 d−i m i r r o r / p r o t o c o l s t r i n g h t tp2 d−i m i r r o r / coun t r y s t r i n g manual3 d−i m i r r o r / h t tp /hostname s t r i n g m i r r o r . i n f o rma t i k . hs−fu r twangen . de4 d−i m i r r o r / h t tp / d i r e c t o r y s t r i n g / m i r r o r s / ubuntu5 d−i m i r r o r / h t tp / proxy s t r i n g67 d−i apt−s e tup / r e s t r i c t e d boo l ean t r u e8 d−i apt−s e tup / u n i v e r s e boo l ean t r u e9 d−i apt−s e tup / backpo r t s boo l ean f a l s e

10 d−i apt−s e tup / u s e m i r r o r boo l ean t r u e11 d−i apt−s e tup / s e r v i c e s−s e l e c t m u l t i s e l e c t s e c u r i t y12 d−i apt−s e tup / s e c u r i t y h o s t s t r i n g m i r r o r . i n f o rma t i k . hs−fu r twangen . de13 d−i apt−s e tup / s e c u r i t y p a t h s t r i n g / m i r r o r s / ubuntu

31 / 37

Page 37: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Partitionierung

1 d−i partman−auto / i n i t a u t o m a t i c a l l y p a r t i t i o n s e l e c t b i g g e s t f r e e2 d−i partman−auto / d i s k s t r i n g /dev / sda3 d−i partman−auto / e x p e r t r e c i p e s t r i n g4 boot−r o o t : :5 20000 10000 33000 ex t36 $pr imary{ } $boo tab l e{ }7 method{ fo rmat } fo rmat{ }8 u s e f i l e s y s t em{ } f i l e s y s t em{ ex t3 }9 mountpoint{ / }

1011 1024 512 4096 l i n u x−swap12 method{ swap } fo rmat{ }13 .14 d−i partman/ c o n f i rm w r i t e n ew l a b e l boo l ean t r u e15 d−i partman/ c h o o s e p a r t i t i o n s e l e c t f i n i s h16 d−i partman−auto / con f i rm boo l ean t r u e17 d−i partman/ con f i rm boo l ean t r u e

32 / 37

Page 38: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Paket- und Userverwaltung

1 d−i passwd/ root−l o g i n boo l ean t r u e2 d−i passwd/make−u s e r boo l ean f a l s e3 d−i passwd/ root−password−c r yp t ed password $1$u3RDhzxa$8Ng09KyCV30rkgyoKhOjQ64 d−i u se r−s e tup / enc rypt−home boo l ean f a l s e5 t a s k s e l t a s k s e l / f i r s t m u l t i s e l e c t ubuntu−desk top6 d−i p k g s e l / i n c l u d e s t r i n g openssh−s e r v e r bu i l d−e s s e n t i a l7 d−i p k g s e l / language−packs m u l t i s e l e c t de8 d−i p k g s e l / update−p o l i c y s e l e c t none9 p opu l a r i t y−c o n t e s t p o p u l a r i t y−c o n t e s t / p a r t i c i p a t e boo l ean f a l s e

33 / 37

Page 39: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Bootloader, Finishing, Skripte

1 d−i grub−i n s t a l l e r / s k i p boo l ean f a l s e2 d−i l i l o−i n s t a l l e r / s k i p boo l ean t r u e3 d−i grub−i n s t a l l e r / o n l y d e b i a n boo l ean f a l s e4 d−i grub−i n s t a l l e r / w i t h o t h e r o s boo l ean t r u e5 d−i grub−i n s t a l l e r / bootdev s t r i n g /dev / sda6 d−i f i n i s h−i n s t a l l / r e b o o t i n p r o g r e s s note7 d−i cdrom−d e t e c t / e j e c t boo l ean t r u e89 d−i p r e s e ed / late command s t r i n g cd / t a r g e t /tmp ; wget h t tp : / /213 . 9 5 . 2 7 . 1 38/

winws10/ p o s t i n s t a l l . sh ; chmod +x / t a r g e t /tmp/ p o s t i n s t a l l . sh ; in−t a r g e t /tmp/p o s t i n s t a l l . sh

34 / 37

Page 40: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Preseed anderer Pakete

1 x s e r v e r−xorg x s e r v e r−xorg / au t od e t e c t mon i t o r boo l ean t r u e2 x s e r v e r−xorg x s e r v e r−xorg / c o n f i g /mon i to r / s e l e c t i o n−method s e l e c t medium3 x s e r v e r−xorg x s e r v e r−xorg / c o n f i g /mon i to r /mode− l i s t s e l e c t 1280 x1024 @ 60 Hz45 sun−j ava6−b in sha r ed / accepted−sun−d l j−v1−1 boo l ean t r u e6 sun−j ava6−j d k sha r ed / accepted−sun−d l j−v1−1 boo l ean t r u e7 sun−j ava6−j r e sha r ed / accepted−sun−d l j−v1−1 boo l ean t r u e

35 / 37

Page 41: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Quellen I

CentOS.Tips and tricks for anaconda and kickstart.http://wiki.centos.org/TipsAndTricks/KickStart.

Debian.Preseed dokumentation.http://d-i.alioth.debian.org/manual/en.i386/apb.html.

FedoraProject.Anaconda/kickstart.http://fedoraproject.org/wiki/Anaconda/Kickstart.

Red Hat.Red hat enterprise linux installation guide.http://centos.org/docs/5/html/Installation Guide-en-US/.

36 / 37

Page 42: Linux Auto Install

Einleitung PXE AutoYaST Kickstart Preseed

Backup

Kickstart

network --device=eth0 --bootproto=query (ask forconfig)Installationsverwaltung

Red Hat Network2

Red Hat Satellite3 und Spacewalk4

Cobbler5

2https://rhn.redhat.com/help/about.pxt3http://www.redhat.com/red_hat_network/4http://spacewalk.redhat.com/5https://fedorahosted.org/cobbler/

37 / 37