In diesem Beitrag geht es vor allem um die Antwortdatei (focalseed.cfg) für die automatische Installation. Man könnte diese Datei auch gleich in das .iso-File speichern. Unser Ansatz – die Datei aus dem Netz herunterzuladen – macht das aber etwas flexibler.
Am Ende findet ihr unsere focalseed.cfg wie wir sie verwenden. Diese Datei haben wir mit Ubuntu 20.04 Desktop probiert. Ein paar Anpassungen sind vermutlich notwendig.
Vorsicht ist bei folgenden Passagen geboten. Die automatische Partitionierung. In unserem System mit ca 30GB /; 30GB /data sowie einer Swap-Partition. Wer es komplexer haben will, kann das natürlich umsetzen. Hier oder hier findet ihr ein anderes Beispiel dazu. Wie man ein Passwort generiert steht im Skript, um Klartextpasswörter zu vermeiden.
Am Ende der Datei führen wir noch unser eigenes Skript aus. Normalerweise wird dazu die Anweisung „d-i preseed/late_command string
“ verwendet. Mit dem Ubuntu-Desktop-Installer (bei der Serverversion übrigens schon) klappt das leider nicht. Aber es gibt eine Lösung: „ubiquity ubiquity/success_command \
“
Der „success_command“ kann eine Aneinanderreihung von Befehlen sein. Aus welchen Gründen auch immer verliert der Desktop am Ende des Scripts die Netzwerkverbindung, daher sind die ersten Befehle „dhclient -r; dhclient -4“. Anschließend laden wir ein weiteres Skript mit wget herunter. Wir speichern es unter „/target/home/user/install.sh“, machen es mit chmod 777 ausführbar und abschließend führen wir es auf unserem Zielsystem aus. Interessehalber werden noch Logfiles mit > bzw. 2> für Fehler generiert.
Was das Skript konkret macht werde ich in Teil 3 vorstellen.
Als sehr praktisch hat sich VirtualBox erwiesen. Damit lässt sich die Umsetzung ganz gut testen.
# regional setting
d-i debian-installer/language string de_DE:de
d-i debian-installer/country string DE
d-i debian-installer/locale string de_DE
d-i debian-installer/splash boolean false
d-i localechooser/supported-locales multiselect de_DE.UTF-8
d-i pkgsel/install-language-support boolean true
# keyboard selection
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/modelcode string pc105
d-i keyboard-configuration/layoutcode string de
d-i keyboard-configuration/xkb-keymap select de
d-i debconf/language string de_DE:de
# network settings
d-i netcfg/choose_interface select auto
d-i netcfg/dhcp_timeout string 5
d-i netcfg/get_hostname string auto1
d-i netcfg/get_domain string mydomain.at
# mirror settings
#d-i mirror/country string manual
#d-i mirror/http/hostname string archive.ubuntu.com
#d-i mirror/http/directory string /ubuntu
#d-i mirror/http/proxy string
# clock and timezone settings
d-i time/zone string Europe/Vienna
d-i clock-setup/utc boolean false
d-i clock-setup/ntp boolean true
# user account setup
d-i passwd/root-login boolean false
d-i passwd/make-user boolean true
d-i passwd/user-fullname string user
d-i passwd/username string user
#create password with $(echo $password | mkpasswd -s -m sha-512)
d-i passwd/user-password-crypted password $6$SKxJQfPgLIhrh$dusXAxDya7sZk2Jbe/KQaG2EOW9Gm5iTQXRLYbjfrp9.P0R4fVTPCjz4SFn6Y.VY8kIIVo87YANab1CxGJKNc1
d-i passwd/user-uid string
d-i user-setup/allow-password-weak boolean false
d-i passwd/user-default-groups string adm cdrom dialout lpadmin plugdev sambashare
d-i user-setup/encrypt-home boolean false
# configure apt
d-i apt-setup/restricted boolean true
d-i apt-setup/universe boolean true
d-i apt-setup/backports boolean true
d-i apt-setup/services-select multiselect security
d-i apt-setup/security_host string security.ubuntu.com
d-i apt-setup/security_path string /ubuntu
tasksel tasksel/first multiselect ubuntu-desktop
d-i pkgsel/upgrade select safe-upgrade
d-i pkgsel/update-policy select none
d-i pkgsel/updatedb boolean true
# disk partitioning
d-i partman-auto/method string regular
d-i partman-auto/expert_recipe string regularvnode :: 28000 10 28000 ext4 $primary{ } $bootable{ } method{ format
} format{ } use_filesystem{ } filesystem{ ext4 } mountpoint{ / } . 1024 50 1024 linux-swap $primary{ } method{ sw
ap } format{ } . 28000 20 28000 ext4 $primary{ } method{ format } format{ } use_filesystem{ } filesystem{ ext4 } m
ountpoint{ /data } .
# numbers: first min disk space, priority, max disk space
# 30 30 -1 ext4 method{ format } format{ } use_filesystem{ } filesystem{ ext4 } mountpoint{ /local } .
d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
# grub boot loader
d-i grub-installer/only_debian boolean true
#d-i grub-installer/bootdev string /dev/sda
d-i grub-installer/bootdev string default
# Ubiquity completly ignores the debian installer command 'preseed/late_command',
# instead we need to use 'ubiquity/success_command'.
ubiquity ubiquity/success_command string dhclient -r; dhclient -4; wget http://SERVER/path/install.sh -O /target/home/user/install.sh; chmod 777 /target/home/user/install.sh; in-target /home/user/install.sh >>/target
/home/user/postinst.log 2>/target/home/user/posterror.log;
ubiquity ubiquity/summary note
ubiquity ubiquity/reboot boolean true
Im Ubuntu-Wiki sowie auf der Debian-Seite gibt es noch weitere Infos zur automatischen Installation mit pressed.
Ein interessantes Konzept ist auch das FAI.
0 Kommentare