#### Debian 13 Fully Automated Server Installation Preseed File #### Save as: preseed.cfg ### Localization d-i debian-installer/locale string en_US.UTF-8 d-i debian-installer/language string en d-i debian-installer/country string PL d-i localechooser/supported-locales multiselect en_US.UTF-8 # Keyboard selection - Polish keyboard d-i keyboard-configuration/xkb-keymap select pl d-i keyboard-configuration/layoutcode string pl d-i keyboard-configuration/variantcode string ### Network configuration d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string server d-i netcfg/get_domain string localdomain d-i netcfg/wireless_wep string # Disable network configuration dialog if no network d-i netcfg/dhcp_failed note d-i netcfg/dhcp_options select Configure network manually ### Mirror settings 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 ### Account setup # Root password = 123 d-i passwd/root-login boolean true d-i passwd/root-password password 123 d-i passwd/root-password-again password 123 # Create user "debian" with password "123" d-i passwd/user-fullname string debian User d-i passwd/username string debian d-i passwd/user-password password 123 d-i passwd/user-password-again password 123 d-i passwd/user-default-groups string audio cdrom video sudo ### Clock and time zone setup d-i clock-setup/utc boolean true d-i time/zone string US/Eastern d-i clock-setup/ntp boolean true ### Partitioning - LVM using entire first disk d-i partman-auto/disk string /dev/nvme0n1 d-i partman-auto/method string lvm d-i partman-lvm/device_remove_lvm boolean true d-i partman-md/device_remove_md boolean true d-i partman-lvm/confirm boolean true d-i partman-lvm/confirm_nooverwrite boolean true # Auto-detect and use first available disk d-i partman/early_command string \ DISK=$(list-devices disk | head -n1); \ debconf-set partman-auto/disk "$DISK"; \ debconf-set grub-installer/bootdev "$DISK" # LVM partitioning recipe d-i partman-auto-lvm/guided_size string max d-i partman-auto-lvm/new_vg_name string vg-main d-i partman-auto/choose_recipe select atomic # Define custom LVM recipe for both BIOS and UEFI d-i partman-auto/expert_recipe string \ boot-root :: \ 512 512 512 fat32 \ $iflabel{ gpt } \ $reusemethod{ } \ method{ efi } \ format{ } \ . \ 1 1 1 free \ $iflabel{ msdos } \ $reusemethod{ } \ method{ biosgrub } \ . \ 512 512 512 ext4 \ $primary{ } $bootable{ } \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ /boot } \ . \ 1000 10000 -1 lvm \ $primary{ } \ method{ lvm } \ vg_name{ vg-main } \ . \ 8192 8192 8192 linux-swap \ $lvmok{ } in_vg{ vg-main } \ lv_name{ swap } \ method{ swap } format{ } \ . \ 10000 20000 -1 ext4 \ $lvmok{ } in_vg{ vg-main } \ lv_name{ root } \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ / } \ . # Confirm partitioning 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 ### Base system installation d-i base-installer/install-recommends boolean false d-i base-installer/kernel/image string linux-image-amd64 ### Package selection tasksel tasksel/first multiselect ssh-server d-i pkgsel/include string sudo curl openssh-server d-i pkgsel/upgrade select full-upgrade d-i pkgsel/update-policy select none # Popularity contest popularity-contest popularity-contest/participate boolean false ### Boot loader installation d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean false d-i grub-installer/bootdev string default d-i grub-installer/force-efi-extra-removable boolean true d-i grub-pc/install_devices string /dev/nvme0n1 d-i grub-pc/install_devices_empty boolean false ### Finish installation d-i finish-install/reboot_in_progress note ### Post-installation commands d-i preseed/late_command string \ in-target mkdir -p /home/debian/.ssh; \ in-target sh -c 'echo server > /etc/hostname; hostnamectl set-hostname server';\ in-target chown debian:debian /home/debian/.ssh; \ in-target chmod 700 /home/debian/.ssh; \ in-target touch /home/debian/.ssh/authorized_keys; \ in-target chown debian:debian /home/debian/.ssh/authorized_keys; \ in-target chmod 600 /home/debian/.ssh/authorized_keys; \ mkdir -p /target/etc/sudoers.d; \ echo "debian ALL=(ALL) NOPASSWD: ALL" > /target/etc/sudoers.d/debian; \ chmod 0440 /target/etc/sudoers.d/debian; \ sed -i 's/^#*PasswordAuthentication.*/PasswordAuthentication yes/' /target/etc/ssh/sshd_config; \ sed -i 's/^#*PubkeyAuthentication.*/PubkeyAuthentication yes/' /target/etc/ssh/sshd_config; \ sed -i 's/^#*PermitRootLogin.*/PermitRootLogin yes/' /target/etc/ssh/sshd_config; \ echo "AllowUsers debian root" >> /target/etc/ssh/sshd_config; \ in-target systemctl enable ssh ### Automatic installation without prompts d-i auto-install/enable boolean true d-i debconf/priority select critical