Skip to content

Instantly share code, notes, and snippets.

@cavemandaveman
Last active June 21, 2020 18:25
Show Gist options
  • Save cavemandaveman/85fb35bc101036488236614ae984c263 to your computer and use it in GitHub Desktop.
Save cavemandaveman/85fb35bc101036488236614ae984c263 to your computer and use it in GitHub Desktop.
### Preseed for Ubuntu 18.04
### Unattended Installation
d-i auto-install/enable boolean true
d-i debconf/priority select critical
### Localization
# Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string en_US
# netcfg will choose an interface that has link if possible. This makes it
# skip displaying a list if there is more than one interface.
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 hw-detect/load_firmware boolean true
# Keyboard selection.
# Disable automatic (interactive) keymap detection.
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select us
### Mirror settings
# If you select ftp, the mirror/country string does not need to be set.
#d-i mirror/protocol string ftp
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
### Account setup
# Skip creation of a root account (normal user account will be able to
# use sudo). The default is false; preseed this to true if you want to set
# a root password.
d-i passwd/root-login boolean true
d-i passwd/root-password-crypted password "!"
# Alternatively, to skip creation of a normal user account.
d-i passwd/make-user boolean false
### Clock and time zone setup
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true
# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string UTC
# Controls whether to use NTP to set the clock during the install
d-i clock-setup/ntp boolean true
### Partitioning
## Partitioning example
# You'll need to specify the method to use.
# The presently available methods are:
# - regular: use the usual partition types for your architecture
# - lvm: use LVM to partition the disk
# - crypto: use LVM within an encrypted partition
d-i partman-auto/method string lvm
# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. This can be preseeded away...
d-i partman-lvm/device_remove_lvm boolean true
# The same applies to pre-existing software RAID array:
d-i partman-md/device_remove_md boolean true
# And the same goes for the confirmation to write the lvm partitions.
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
# For LVM partitioning, you can select how much of the volume group to use
# for logical volumes.
d-i partman-auto-lvm/guided_size string max
d-i partman-auto-lvm/new_vg_name string vg_sys
d-i partman-auto/expert_recipe string \
custom-lvm :: \
1 1 1 free \
$bios_boot{ } \
method{ biosgrub } \
. \
256 1 256 fat32 \
$primary{ } \
method{ efi } format{ } \
. \
512 1 512 ext4 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /boot } \
. \
512 512 100% linux-swap $lvmok{ } \
lv_name{ lv_swap } \
in_vg { vg_sys } \
method{ swap } format{ } \
. \
8959 1 8959 ext4 $lvmok{ } \
lv_name{ lv_root } \
in_vg { vg_sys } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
. \
2048 1 2048 ext4 $lvmok{ } \
lv_name{ lv_home } \
in_vg { vg_sys } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /home } \
. \
4096 1 4096 ext4 $lvmok{ } \
lv_name{ lv_tmp } \
in_vg { vg_sys } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /tmp } \
. \
4096 1 4096 ext4 $lvmok{ } \
lv_name{ lv_var } \
in_vg { vg_sys } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /var } \
. \
# This makes partman automatically partition without confirmation, provided
# that you told it what to do using one of the methods above.
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
# GPT settings
d-i partman-partitioning/no_bootable_gpt_biosgrub boolean false
d-i partman-partitioning/no_bootable_gpt_efi boolean false
# enforce usage of GPT - a must have to use EFI!
d-i partman-basicfilesystems/choose_label string gpt
d-i partman-basicfilesystems/default_label string gpt
d-i partman-partitioning/choose_label string gpt
d-i partman-partitioning/default_label string gpt
d-i partman/choose_label string gpt
d-i partman/default_label string gpt
# Keep that one set to true so we end up with a UEFI enabled
# system. If set to false, /var/lib/partman/uefi_ignore will be touched
d-i partman-efi/non_efi_system boolean true
### Package selection
tasksel tasksel/first multiselect server
# Individual additional packages to install
d-i pkgsel/include string openssh-server qemu-guest-agent
# Whether to upgrade packages after debootstrap.
# Allowed values: none, safe-upgrade, full-upgrade
d-i pkgsel/upgrade select full-upgrade
# Language pack selection
#d-i pkgsel/language-packs multiselect de, en, zh
# Policy for applying updates. May be "none" (no automatic updates),
# "unattended-upgrades" (install security updates automatically), or
# "landscape" (manage system with Landscape).
d-i pkgsel/update-policy select none
# Some versions of the installer can report back on what software you have
# installed, and what software you use. The default is not to report back,
# but sending reports helps the project determine what software is most
# popular and include it on CDs.
popularity-contest popularity-contest/participate boolean false
# By default, the system's locate database will be updated after the
# installer has finished installing most packages. This may take a while, so
# if you don't want it, you can set this to "false" to turn it off.
d-i pkgsel/updatedb boolean false
### Boot loader installation
# This is fairly safe to set, it makes grub install automatically to the MBR
# if no other operating system is detected on the machine.
d-i grub-installer/only_debian boolean true
# This one makes grub-installer install to the MBR if it also finds some other
# OS, which is less safe as it might not be able to boot that other OS.
d-i grub-installer/with_other_os boolean true
d-i preseed/late_command string \
in-target sh -c 'useradd -m -s /bin/bash -p '\''$6$jPpOecnig/ww7jTO$XZXuvZq9wqxjo1kJ7UtFcxfXvAL3lYBePKu/KXf7W5mgIYTzl0f8Ov75/N7Fq6sDYNhYP5X/a/7DrEN6VOgUw0'\'' admin'; \
echo 'admin ALL=(ALL:ALL) ALL' > /target/etc/sudoers.d/admin; \
in-target chmod 440 /etc/sudoers.d/admin;
### Finishing up the installation
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note
# This will prevent the installer from ejecting the CD during the reboot,
# which is useful in some situations.
d-i cdrom-detect/eject boolean true
# This is how to make the installer shutdown when finished, but not
# reboot into the installed system.
d-i debian-installer/exit/poweroff boolean true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment