Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CalvinHartwell/56a9a6d408533de125bdea920fb1199f to your computer and use it in GitHub Desktop.
Save CalvinHartwell/56a9a6d408533de125bdea920fb1199f to your computer and use it in GitHub Desktop.
ubuntu-16.04.3-lts-preseed.cfg
### Preseed for Ubuntu 16.04.3 LTS
# Derived from: https://help.ubuntu.com/lts/installation-guide/example-preseed.txt
### Localization
# Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string en_US.UTF8
d-i localechooser/supported-locales multiselect en_US.UTF-8
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select GB
### Network configuration
d-i /choose_interface select auto
# d-i netcfg/hostname string device
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i hw-detect/load_firmware boolean true
d-i netcfg/wireless_wep string
### Mirror settings (replace me if local mirror)
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
d-i passwd/root-login boolean true
d-i passwd/root-password-crypted password !!
d-i passwd/make-user boolean false
# The root password is disabled by default.
### Clock and time zone setup
d-i clock-setup/utc boolean true
d-i time/zone string UTC
d-i clock-setup/ntp boolean true
# LG provided NTP, should be replaced!
d-i clock-setup/ntp-server string ntp.ubuntu.com
### Partitioning
d-i preseed/early_command string umount /media || true
d-i partman-auto/method string lvm
d-i partman-auto-lvm/guided_size string max
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto-lvm/new_vg_name string main
d-i partman-md/device_remove_md boolean true
d-i partman-md/confirm boolean true
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
d-i partman-basicmethods/method_only boolean false
### Partitioning
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
### EFI
d-i partman-efi/non_efi_system boolean true
### Grub
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
### Disk layout
d-i partman-auto-lvm/new_vg_name string vg-root
d-i partman-auto/expert_recipe string \
custom-lvm :: \
269 269 269 ext4 $primary{ } $bootable{ } \
mountpoint{ /boot } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
. \
2152 2152 100% linux-swap $lvmok{ } \
lv_name{ lv_swap } \
in_vg { vg-root } \
method{ swap } \
format{ } \
. \
8608 1 8608 ext4 $lvmok{ } \
mountpoint{ / } \
lv_name{ lv_root } \
in_vg { vg-root } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
. \
1076 1 1076 ext4 $lvmok{ } \
mountpoint{ /export/home } \
lv_name{ lv_home } \
in_vg { vg-root } \
method{ format } \
format{ } \
options/nodev{ nodev } \
use_filesystem{ } \
filesystem{ ext4 } \
. \
1076 1 1076 ext4 $lvmok{ } \
mountpoint{ /tmp } \
lv_name{ lv_tmp } \
in_vg { vg-root } \
method{ format } \
format{ } \
options/nodev{ nodev } \
options/nosuid{ nosuid } \
options/noexec{ noexec } \
use_filesystem{ } \
filesystem{ ext4 } \
. \
2152 1 2152 ext4 $lvmok{ } \
mountpoint{ /var } \
lv_name{ lv_var } \
in_vg { vg-root } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
. \
2152 1 2152 ext4 $lvmok{ } \
mountpoint{ /var/log } \
lv_name{ lv_log } \
in_vg { vg-root } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
. \
538 1 538 ext4 $lvmok{ } \
mountpoint{ /var/log/audit } \
lv_name{ lv_audit } \
in_vg { vg-root } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
. \
128 1 -1 ext4 $lvmok{ } \
mountpoint{ /tmp/delete } \
lv_name{ lv_delete } \
in_vg { vg-root } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
.
### Base system installation
d-i base-installer/install-recommends boolean true
d-i base-installer/kernel/image string linux-generic
d-i debconf debconf/frontend select Noninteractive
### Apt setup
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/use_mirror boolean false
d-i apt-setup/services-select multiselect security, updates
d-i apt-setup/security_host string security.ubuntu.com
d-i apt-setup/security_path string /ubuntu
### Package selection
d-i tasksel/first multiselect none
d-i pkgsel/include string openssh-server python
d-i pkgsel/upgrade select full-upgrade
d-i pkgsel/update-policy select unattended-upgrades
# Individual additional packages to install
d-i pkgsel/include string openssh-server \
vim \
git \
tmux \
build-essential \
open-vm-tools \
telnet \
wget \
curl \
python
### Finishing up the installation
d-i preseed/late_command string \
cp -r /custom /target/custom; \
in-target sh -c 'mkdir -p --mode=0700 /root/.ssh && cat /custom/userkey.pub > /root/.ssh/authorized_keys && chmod 0600 /root/.ssh/authorized_keys'; \
in-target sh -c 'sed -i "s/^#PermitRootLogin.*\$/PermitRootLogin prohibit-password/g" /etc/ssh/sshd_config'; \
in-target sh -c 'rm -f /etc/ssh/ssh_host_*_key* && mkdir -p /usr/lib/systemd/system && cp /custom/ssh-host-keygen.service /usr/lib/systemd/system/ssh-host-keygen.service && systemctl enable ssh-host-keygen.service'; \
in-target sh -c 'echo "IPv4: \\\4" >> /etc/issue && echo "IPv6: \\\6" >> /etc/issue && echo "" >> /etc/issue'; \
in-target sh -c 'eject || true'; \
rm -r /target/custom;
d-i debian-installer/splash boolean false
d-i cdrom-detect/eject boolean true
### Shutdown machine
d-i finish-install/reboot_in_progress note
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