Debian preseed example (old)

From techdocs
Jump to navigation Jump to search

While informative, this is an old page (which you can see from its reference to Debian Buster).

  1. Require a web server accessible from the host-to-set-up
  2. Require a copy of the Debian [Buster] install CD/DVD (on USB?)
  3. Require a DHCP server configured to give the host-to-set-up its IP address/mask/gateway/DNS servers, etc.
  4. Boot from install media
  5. At install menu, press <ESC>
  6. At prompt, enter: auto url=http://192.168.100.1/basic.cfg and press <RETURN>
  7. Sit back and glory in a job well done

See Debian: Automating the installation using preseeding

basic.cfg

d-i debian-installer/locale                                     string en_AU

d-i keyboard-configuration/xkb-keymap                           select us

d-i netcfg/choose_interface                                     select auto
d-i netcfg/get_hostname                                         string unassigned-hostname
d-i netcfg/get_domain                                           string unassigned-domain
d-i netcfg/wireless_wep                                         string

d-i mirror/country                                              string manual
d-i mirror/http/hostname                                        string deb.debian.org
d-i mirror/http/directory                                       string /debian
d-i mirror/http/proxy                                           string

d-i clock-setup/utc                                             boolean true
d-i time/zone                                                   string Australia/Sydney
d-i clock-setup/ntp                                             boolean true

d-i pkgsel/include                                              string cfengine3 openssh-server

d-i passwd/make-user                                            boolean false
d-i passwd/root-password-crypted                                password $6$VcS7ybrq3LtM1INK$TstQLYccguE5jLFKjI7CkW9wf7hWgx6XkI.3lSpOj.NcgzY5FHaC2Ffl2e9pY/ZdIL8ffo1zP7QYAG6IIg82r0

d-i partman-auto/method                                         string regular
d-i partman-auto/expert_recipe string                           \
        boot-root ::                                            \
                500 1000 1000 ext4                              \
                        $primary{ } $bootable{ }                \
                        method{ format } format{ }              \
                        use_filesystem{ } filesystem{ ext4 }    \
                        mountpoint{ /boot }                     \
                .                                               \
                5000 10000 1000000000 ext4                      \
                        $primary{ }                             \
                        method{ format } format{ }              \
                        use_filesystem{ } filesystem{ ext4 }    \
                        mountpoint{ / }                         \
                .                                               \
                1000 1000 1000 linux-swap                       \
                        $primary{ }                             \
                        method{ swap } format{ }                \
                .
d-i partman-partitioning/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

# 1 - Remove cfengine's "default" inputs and masterfiles subdirectories
# 2 - Create new, empty ones
# 3 - Edit the default settings for cfengine so that cf-execd will start
# 4 - Edit the kernel command line in grub so we get "eth0"-style naming instead of "ens4"-style
# 5 - Re-generate the configuration file used by grub at boot time
# 6 - Rename the network interface already configured by the installer in /etc/network/interfaces
# 7 - Configure cf-agent (cfengine) to point to our configuration hub

d-i preseed/late_command string                                                                                         \
        in-target rm -fr /var/lib/cfengine3/inputs /var/lib/cfengine3/masterfiles;                                      \
        in-target mkdir /var/lib/cfengine3/inputs /var/lib/cfengine3/masterfiles;                                       \
        in-target sed -i.backup -e 's/^RUN_CFEXECD=0$/RUN_CFEXECD=1/' /etc/default/cfengine3;                           \
        in-target sed -i.backup -e 's/quiet/quiet biosdevname=0 net.ifnames=0 ipv6.disable=1/' /etc/default/grub;       \
        in-target grub-mkconfig -o /boot/grub/grub.cfg;                                                                 \
        in-target sed -i.backup -e 's/ [ep][a-z0-9_]*[0-9]/ eth0/' /etc/network/interfaces;                             \
        in-target cf-agent -B 10.197.85.13

d-i grub-installer/only_debian                                  boolean true
d-i grub-installer/with_other_os                                boolean true
d-i grub-installer/bootdev                                      string /dev/vda

d-i finish-install/reboot_in_progress note