Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende Überarbeitung | |||
de:services:server_services:preseeding:start [2021/06/14 17:51] – [Download] Ubuntu 20.04 bwegman1 | de:services:server_services:preseeding:start [2022/08/15 14:20] (aktuell) – bwegman1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ====== Preseeding ====== | ||
+ | |||
+ | |||
+ | |||
+ | ===== Was ist preseeding? ===== | ||
+ | |||
+ | Preseeding ist ein Verfahren für den Debian-Installer (([[http:// | ||
+ | |||
+ | Die Antworten - und damit die Konfiguration des Installers - werden in einer '' | ||
+ | |||
+ | ===== Preseeding-Images ===== | ||
+ | |||
+ | Die hier angebotenen ISO-Images können genutzt werden, um Ubuntu-Server in der jeweiligen Version und Umgebung zu installieren. | ||
+ | |||
+ | === Bitte beachten! === | ||
+ | |||
+ | |||
+ | |||
+ | Diese ISO-Images sind **modifizierte Netinstaller-Images von Ubuntu und Debian**, in denen eine Preseeding-Konfiguration direkt in der initrd des Installers platziert wurde. Dies bedeutet, dass ein Server in dieser Version und mit dieser Konfiguration automatisch installiert wird. | ||
+ | |||
+ | <WRAP center round important 70%> | ||
+ | Diese ISOs sollten __**NIEMALS**__ von einem System mit einem vorhandenen Betriebssystem gebootet werden, da __**ungefragt und automatisch**__ mit der Installation und damit __**dem Überschreiben der ersten Festplatte ''/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Anpassungen der Images ==== | ||
+ | |||
+ | Folgendes wurde in den Images angepasst: | ||
+ | |||
+ | * Hostname und Domain sind auf ubuntu.local bzw debian.local festgelegt, was durch ein erfolgreichen reverse DNS lookup bzw. DHCP während der Installation aber überschrieben wird | ||
+ | * primärer Benutzer ist '' | ||
+ | * die erste Festplatte wird als LVM (([[http:// | ||
+ | * '' | ||
+ | * verschiedene Voreinstellung für deutsche Sprache (locale, apt mirror, keyboard layout) | ||
+ | * automatische Installation von Sicherheitsupdates durch das Paket '' | ||
+ | |||
+ | Für die VMWare-VMs wurde zusätzlich angepasst: | ||
+ | |||
+ | * '' | ||
+ | * RAM-Komprimierung mit '' | ||
+ | * kein Swap auf physischen Blockdevices | ||
+ | * IO-Scheduler per Kernel-Parameter auf '' | ||
+ | |||
+ | ==== Voraussetzungen ==== | ||
+ | |||
+ | Diese Images können auf Systemen oder VMs eingesetzt werden, die folgende Voraussetzungen erfüllen: | ||
+ | |||
+ | * ''/ | ||
+ | * de.archive.ubuntu.com muss für das System erreichbar sein. | ||
+ | * Bootreihenfolge muss "HDD, CDROM" sein, damit nach einem Neustart nicht die Installation erneut beginnt. | ||
+ | * falls kein DHCP vorhanden ist, wird der Installer nach einer statischen Netzwerkkonfiguration fragen, der Rest läuft weiterhin automatisch ab. | ||
+ | |||
+ | ==== Download ==== | ||
+ | |||
+ | Die Images und verwendeten preseed.cfg können hier herunter geladen werden: | ||
+ | |||
+ | * Images für die Verwendung in __Virtual Machines__ (VMWare und andere): | ||
+ | * [[https:// | ||
+ | * Übersicht aller Downloads: | ||
+ | * [[https:// | ||
+ | |||
+ | ===== Installation und Nacharbeiten ===== | ||
+ | |||
+ | Die Installation eines Servers mit einem der Preseeding-Images läuft weitgehend (abhängig von der Umgebung) automatisch ab, indem der Server von diesem Image gebootet wird ([[# | ||
+ | |||
+ | Da praktisch alle Fragen des Installers vorgegeben sind, ist die grafische Rückmeldung während der Installation reduziert. Die Installation sollte aber nicht unterbrochen werden, wenn für ein paar Minuten keine Meldung oder kein Fortschritt dargestellt wird. Am Ende der Installation startet der Installer das System neu und man kann sich mit dem vorgegebenen Benutzernamen und Passwort anmelden, lokal oder per SSH. | ||
+ | |||
+ | Folgende Schritte sollten möglichst direkt nach der Installation geprüft und ggf. unternommen werden: | ||
+ | |||
+ | - __**Änderung des Passwort**__ des primären Benutzers boss | ||
+ | - ggf. Änderung des Hostnamens und der Domain, falls diese bei der Installation nicht durch ein reverse DNS lookup aufgelöst und gesetzt wurden. | ||
+ | - Anlegen von neuen Logical Volumes oder Vergrößerung von vorhandenen Logical Volumes, um bisher ungenutzten Speicherplatz zu verwenden. | ||
+ | |||
+ | ==== Änderung von Passwörtern ==== | ||
+ | |||
+ | Nach der Anmeldung am System mit dem Standardbenutzernamen und -passwort aus der Preseeding-Konfiguration muss das Passwort((http:// | ||
+ | |||
+ | < | ||
+ | boss@ubuntu: | ||
+ | Ändern des Passworts für boss. | ||
+ | (aktuelles) UNIX-Passwort: | ||
+ | Geben Sie ein neues UNIX-Passwort ein: | ||
+ | Geben Sie das neue UNIX-Passwort erneut ein: | ||
+ | passwd: Passwort erfolgreich geändert | ||
+ | boss@ubuntu: | ||
+ | </ | ||
+ | |||
+ | ==== Änderung des Hostnames ==== | ||
+ | |||
+ | Eine nachträgliche Änderung des Hostnames((http:// | ||
+ | |||
+ | < | ||
+ | pfadmin@powerfolder: | ||
+ | powerfolder.gwdg.de | ||
+ | pfadmin@powerfolder: | ||
+ | </ | ||
+ | Zum Ändern des Hostnamens von " | ||
+ | |||
+ | < | ||
+ | boss@ubuntu: | ||
+ | [sudo] password for boss: | ||
+ | root@ubuntu: | ||
+ | root@ubuntu: | ||
+ | |||
+ | 127.0.0.1 localhost | ||
+ | 127.0.1.1 ubuntu.local | ||
+ | |||
+ | # The following lines are desirable for IPv6 capable hosts | ||
+ | ::1 | ||
+ | fe00::0 ip6-localnet | ||
+ | ff00::0 ip6-mcastprefix | ||
+ | ff02::1 ip6-allnodes | ||
+ | ff02::2 ip6-allrouters | ||
+ | |||
+ | root@ubuntu: | ||
+ | root@ubuntu: | ||
+ | root@ubuntu: | ||
+ | |||
+ | 127.0.0.1 localhost | ||
+ | 127.0.1.1 ubuntu-machine.gwdg.de | ||
+ | |||
+ | # The following lines are desirable for IPv6 capable hosts | ||
+ | ::1 | ||
+ | fe00::0 ip6-localnet | ||
+ | ff00::0 ip6-mcastprefix | ||
+ | ff02::1 ip6-allnodes | ||
+ | ff02::2 ip6-allrouters | ||
+ | |||
+ | root@ubuntu: | ||
+ | root@ubuntu: | ||
+ | |||
+ | ubuntu | ||
+ | |||
+ | root@ubuntu: | ||
+ | root@ubuntu: | ||
+ | |||
+ | ubuntu-machine | ||
+ | |||
+ | root@ubuntu: | ||
+ | root@ubuntu: | ||
+ | root@ubuntu: | ||
+ | An alle Benutzer verteilte Nachricht von boss@ubuntu | ||
+ | (/ | ||
+ | |||
+ | Das System wird sich JETZT zum Neustarten herunterfahren! | ||
+ | </ | ||
+ | ==== Änderung des Logical Volume Managers ==== | ||
+ | |||
+ | Unabhängig von der Größe der Festplatte richtet die Installation recht sparsam bemessene Logical Volumes für Dateisysteme ein, um für später größere Flexibilität zu behalten. Hier wird beschrieben, | ||
+ | |||
+ | === Vergrößerung eines Logical Volumes === | ||
+ | |||
+ | Im Folgenden wird festgestellt, | ||
+ | |||
+ | Wechsel zu root, anzeigen der Mount-Points: | ||
+ | |||
+ | < | ||
+ | boss@ubuntu-machine: | ||
+ | [sudo] password for boss: | ||
+ | root@ubuntu-machine: | ||
+ | root@ubuntu-machine: | ||
+ | / | ||
+ | proc on /proc type proc (rw, | ||
+ | sysfs on /sys type sysfs (rw, | ||
+ | udev on /dev type devtmpfs (rw, | ||
+ | (...) | ||
+ | root@ubuntu-machine: | ||
+ | </ | ||
+ | Das Haupt-Dateisystem ''/'' | ||
+ | |||
+ | < | ||
+ | root@ubuntu-machine: | ||
+ | LV | ||
+ | rootlv rootvg -wi-ao 4,79g | ||
+ | root@ubuntu-machine: | ||
+ | </ | ||
+ | Die LV '' | ||
+ | |||
+ | < | ||
+ | root@ubuntu-machine: | ||
+ | VG #PV #LV #SN Attr VSize VFree | ||
+ | rootvg | ||
+ | </ | ||
+ | Die VG '' | ||
+ | |||
+ | < | ||
+ | root@ubuntu-machine: | ||
+ | root@ubuntu-machine: | ||
+ | Extending logical volume rootlv to 5,79 GiB | ||
+ | Logical volume rootlv successfully resized | ||
+ | root@ubuntu-machine: | ||
+ | </ | ||
+ | Danach kann auch das in dem LV liegende Dateisystem erweitert werden. Da es sich hier um ein ext4-Dateisystem handelt, kann die Größenänderung online erfolgen, ohne das Dateisystem auszuhängen: | ||
+ | |||
+ | < | ||
+ | root@ubuntu-machine: | ||
+ | resize2fs 1.42 (29-Nov-2011) | ||
+ | Das Dateisystem auf / | ||
+ | old_desc_blocks = 1, new_desc_blocks = 1 | ||
+ | Eine Online-Grössenänderung von / | ||
+ | Das Dateisystem auf / | ||
+ | |||
+ | root@ubuntu-machine: | ||
+ | root@ubuntu-machine: | ||
+ | Dateisystem | ||
+ | / | ||
+ | udev | ||
+ | tmpfs 100M 300K | ||
+ | none | ||
+ | none | ||
+ | root@ubuntu-machine: | ||
+ | </ | ||
+ | === Anlegen eines neuen Logical Volumes === | ||
+ | |||
+ | Im Folgenden wird ein neues Logical Volume mit einem ext4-Dateisystem angelegt und unter dem neuen Mount-Point ''/ | ||
+ | |||
+ | Wechsel zu '' | ||
+ | |||
+ | < | ||
+ | boss@ubuntu-machine: | ||
+ | [sudo] password for boss: | ||
+ | root@ubuntu-machine: | ||
+ | root@ubuntu-machine: | ||
+ | VG #PV #LV #SN Attr VSize VFree | ||
+ | rootvg | ||
+ | root@ubuntu-machine: | ||
+ | </ | ||
+ | In der Volume Group rootvg ist noch 1,41GB frei. Nun wird ein Logical Volume mit dem Namen '' | ||
+ | |||
+ | < | ||
+ | root@ubuntu-machine: | ||
+ | Logical volume " | ||
+ | root@ubuntu-machine: | ||
+ | root@ubuntu-machine: | ||
+ | mke2fs 1.42 (29-Nov-2011) | ||
+ | Dateisystem-Label= | ||
+ | OS-Typ: Linux | ||
+ | Blockgröße=4096 (log=2) | ||
+ | Fragmentgröße=4096 (log=2) | ||
+ | Stride=0 Blöcke, Stripebreite=0 Blöcke | ||
+ | 44832 Inodes, 179200 Blöcke | ||
+ | 8960 Blöcke (5.00%) reserviert für den Superuser | ||
+ | Erster Datenblock=0 | ||
+ | Maximale Dateisystem-Blöcke=184549376 | ||
+ | 6 Blockgruppen | ||
+ | 32768 Blöcke pro Gruppe, 32768 Fragmente pro Gruppe | ||
+ | 7472 Inodes pro Gruppe | ||
+ | Superblock-Sicherungskopien gespeichert in den Blöcken: | ||
+ | 32768, 98304, 163840 | ||
+ | |||
+ | Platz für Gruppentabellen wird angefordert: | ||
+ | Inode-Tabellen werden geschrieben: | ||
+ | Erstelle Journal (4096 Blöcke): erledigt | ||
+ | Schreibe Superblöcke und Dateisystem-Accountinginformationen: | ||
+ | |||
+ | root@ubuntu-machine: | ||
+ | </ | ||
+ | Nun wird ein Mount-Point ''/ | ||
+ | |||
+ | < | ||
+ | root@ubuntu-machine: | ||
+ | root@ubuntu-machine: | ||
+ | root@ubuntu-machine: | ||
+ | |||
+ | # /etc/fstab: static file system information. | ||
+ | # | ||
+ | # Use ' | ||
+ | # device; this may be used with UUID= as a more robust way to name devices | ||
+ | # that works even if disks are added and removed. See fstab(5). | ||
+ | # | ||
+ | # <file system> <mount point> | ||
+ | proc /proc | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | |||
+ | root@ubuntu-machine: | ||
+ | root@ubuntu-machine: | ||
+ | root@ubuntu-machine: | ||
+ | root@ubuntu-machine: | ||
+ | Dateisystem | ||
+ | / | ||
+ | udev 241M 4,0K 241M 1% /dev | ||
+ | tmpfs | ||
+ | none 5,0M | ||
+ | none 248M | ||
+ | / | ||
+ | root@ubuntu-machine: | ||
+ | </ | ||
+ | === Vergrößerung einer Volume Group mit zusätzlichen Festplatten === | ||
+ | |||
+ | Dem virtuellen Server wurde zuvor eine zusätzliche, | ||
+ | |||
+ | Der Befehl '' | ||
+ | |||
+ | < | ||
+ | root@ubuntu-machine: | ||
+ | NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT | ||
+ | sda | ||
+ | └─sda1 | ||
+ | ├─rootvg-swaplv (dm-0) | ||
+ | ├─rootvg-rootlv (dm-1) | ||
+ | └─rootvg-docroot (dm-2) 252:2 0 | ||
+ | sdb | ||
+ | sr0 11:0 1 20,7M 0 rom | ||
+ | root@ubuntu-machine: | ||
+ | root@ubuntu-machine: | ||
+ | PV | ||
+ | / | ||
+ | root@ubuntu-machine: | ||
+ | root@ubuntu-machine: | ||
+ | VG #PV #LV #SN Attr VSize VFree | ||
+ | rootvg | ||
+ | root@ubuntu-machine: | ||
+ | </ | ||
+ | Nun wird '' | ||
+ | |||
+ | < | ||
+ | root@ubuntu-machine: | ||
+ | Physical volume "/ | ||
+ | root@ubuntu-machine: | ||
+ | root@ubuntu-machine: | ||
+ | PV | ||
+ | / | ||
+ | / | ||
+ | root@ubuntu-machine: | ||
+ | </ | ||
+ | Die Volume Group '' | ||
+ | |||
+ | < | ||
+ | root@ubuntu-machine: | ||
+ | Volume group " | ||
+ | root@ubuntu-machine: | ||
+ | root@ubuntu-machine: | ||
+ | PV | ||
+ | / | ||
+ | / | ||
+ | root@ubuntu-machine: | ||
+ | root@ubuntu-machine: | ||
+ | VG #PV #LV #SN Attr | ||
+ | rootvg | ||
+ | root@ubuntu-machine: | ||
+ | </ | ||
+ | Neue Logical Volumes oder Vergrößerungen von Logical Volumes in rootvg können nun den gesamten freien Platz der '' | ||
+ | |||
+ | ===== Anpassung eines Images mit eigener Konfiguration ===== | ||
+ | |||
+ | Die hier unter [[## | ||
+ | |||
+ | Im Folgenden werden Schritte mit Beispiel-Befehlen beschrieben. Pfade, Dateinamen etc. können von dem jeweiligen, individuellen Einsatzzweck abweichen. Das Ergebnis der u.s. Schritte ist eine Nezinstall-ISO mit einer Preseed-Konfiguration in der initrd des Installers. | ||
+ | |||
+ | Die Ablauf ist dabei im wesentlichen: | ||
+ | |||
+ | - Mounten der ISO | ||
+ | - Kopieren des Inhalts | ||
+ | - Entpacken der initrd | ||
+ | - Platzieren der Preseeding-Konfiguration | ||
+ | - Packen der Initrd | ||
+ | - Remastering der ISO | ||
+ | |||
+ | ==== Erstellen einer angepassten Preseeding-ISO ==== | ||
+ | |||
+ | Erster Schritt ist der Download eines ISO-Images. Es muss sich hierbei um ein bootbares ISO-Image mit dem Debian Installer handeln, von dem sonst eine normale Installation möglich wäre. Als Ausgangsbasis kann auch eines der unter #Download hinterlegten Images verwendet werden. | ||
+ | |||
+ | < | ||
+ | benny@UbuntuBW: | ||
+ | --2013-05-28 09: | ||
+ | Auflösen des Hostnamen »archive.ubuntu.com (archive.ubuntu.com)«... 2001: | ||
+ | Verbindungsaufbau zu archive.ubuntu.com (archive.ubuntu.com)|2001: | ||
+ | HTTP-Anforderung gesendet, warte auf Antwort... 200 OK | ||
+ | Länge: 35651584 (34M) [application/ | ||
+ | In »»mini.iso«« speichern. | ||
+ | |||
+ | 100%[===========================================================================================> | ||
+ | |||
+ | 2013-05-28 09:56:35 (9,54 MB/s) - »»mini.iso«« gespeichert [35651584/ | ||
+ | </ | ||
+ | Als nächstes werden zwei Arbeitsverzeichnisse angelegt, wo das ISO gmounted und dann der Inhalt dorthin kopiert wird. | ||
+ | |||
+ | < | ||
+ | root@UbuntuBW: | ||
+ | </ | ||
+ | Dann wird mit '' | ||
+ | |||
+ | < | ||
+ | root@UbuntuBW: | ||
+ | root@UbuntuBW: | ||
+ | /dev/loop0: [fc04]: | ||
+ | root@UbuntuBW: | ||
+ | mount: warning: /tmp/cdrom/ seems to be mounted read-only. | ||
+ | root@UbuntuBW: | ||
+ | </ | ||
+ | Der folgende Schritt ist optional, aber empfohlen. Hierbei wird ein Timeout für das Bootmenü der Installer-CD gesetzt, damit die Installation davon auch automatisch beginnen kann und nicht auf eine Benutzereingabe gewartet werden muss. Hier wurde der Wert '' | ||
+ | |||
+ | < | ||
+ | root@UbuntuBW:/ | ||
+ | # D-I config version 2.0 | ||
+ | include menu.cfg | ||
+ | default vesamenu.c32 | ||
+ | prompt 0 | ||
+ | timeout 100 | ||
+ | </ | ||
+ | Im nächsten Schritt wird ein Arbeitsverzeichnis für das Entpacken der initrd angelegt, die initrd entpackt, eine preseed.cfg dorthin kopiert, die initrd wieder gepackt und das Arbeitsverzeichnis gelöscht, um Platz auf der ISO zu sparen. | ||
+ | |||
+ | < | ||
+ | root@UbuntuBW:/ | ||
+ | root@UbuntuBW:/ | ||
+ | root@UbuntuBW:/ | ||
+ | root@UbuntuBW:/ | ||
+ | root@UbuntuBW:/ | ||
+ | </ | ||
+ | Nun kann das ISO mit der neuen initrd erstellt, danach das ursprüngliche ISO ausgehängt und alle Arbeitsverzeichnisse gelöscht werden. Der Befehl '' | ||
+ | |||
+ | < | ||
+ | root@UbuntuBW:/ | ||
+ | root@UbuntuBW:/ | ||
+ | </ | ||
+ | ==== Automatische Erstellung einer Preseeding-ISO mittels Skript ==== | ||
+ | |||
+ | Die [[# | ||
+ | |||
+ | Das Skript, welches zur Erstellung der hier angebotenen Images verwendet wurde, findet sich ebenfalls unter den Downloads der Images: | ||
+ | |||
+ | * [[https:// | ||
+ | |||
+ | Das Skript wird als root aufgerufen mit den originalen ISO, der '' | ||
+ | |||
+ | < | ||
+ | mkpreseediso.sh < | ||
+ | </ | ||
+ | Zusätzlich zu den o.g. Schritten erzwingt das Skript das deutsche Tastaturlayout beim Installer per Kernelparameter, | ||
+ | |||
+ | Für weitere Änderungen, | ||
+ | |||
+ | < | ||
+ | benny@UbuntuBW: | ||
+ | OK: ISO file found at / | ||
+ | OK: preseed.cfg found at / | ||
+ | INFO: Creating working directories... done. | ||
+ | INFO: mounting ISO on loopback... done. Mounted at /dev/loop0. | ||
+ | INFO: mounting loopback at working directory... done. | ||
+ | INFO: copying netinstall contents to working directory... done. | ||
+ | INFO: adding timeout to boot menu... done. | ||
+ | INFO: adding keymap tp kernel parameters... done. | ||
+ | INFO: creating working directories for initrd... done. | ||
+ | INFO: unpacking initrd... done. | ||
+ | INFO: copying preseed.cfg... done. | ||
+ | INFO: rebuilding initrd... done. | ||
+ | INFO: cleaning up initrd tmp dir... done. | ||
+ | INFO: remastering ISO... done. ISO file written to / | ||
+ | INFO: cleaning up... done. | ||
+ | benny@UbuntuBW: | ||
+ | </ | ||
+ | ===== Links ===== | ||