Skip to content

Instantly share code, notes, and snippets.

@mafonso
Created May 9, 2020 18:06
Show Gist options
  • Save mafonso/ecbae7484182eed35118902a4112d6b2 to your computer and use it in GitHub Desktop.
Save mafonso/ecbae7484182eed35118902a4112d6b2 to your computer and use it in GitHub Desktop.
Ubuntu preseed
#### Contents of the preconfiguration file (for xenial)
### Localization
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string uk
d-i keyboard-configuration/layout select English (UK)
d-i keyboard-configuration/variant select English (UK)
d-i keyboard-configuration/xkb-keymap select uk
d-i keyboard-configuration/modelcode string pc105
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
### Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string gb.archive.ubuntu.com
d-i mirror/http/directory string /ubuntu
d-i mirror/http/proxy string
### Account setup
d-i passwd/user-fullname string
d-i passwd/username string ansible
d-i passwd/user-password password ansible
d-i passwd/user-password-again password ansible
d-i user-setup/allow-password-weak boolean true
d-i user-setup/encrypt-home boolean false
### 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
### Partitioning
# NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
# nvme0n1 259:0 0 465.8G 0 disk
# |-nvme0n1p1 259:1 0 487M 0 part /boot
# |-nvme0n1p2 259:2 0 90.6G 0 part
# | |-os-root 252:0 0 85.9G 0 lvm /
# | `-os-swap 252:1 0 4.8G 0 lvm [SWAP]
# |-nvme0n1p3 259:3 0 1K 0 part
# `-nvme0n1p5 259:4 0 374.7G 0 part
d-i partman-auto/init_automatically_partition select Manual
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-lvm/device_remove_lvm_span 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
d-i partman/confirm_nooverwrite boolean true
d-i partman-auto-lvm/guided_size string max
d-i partman-auto-lvm/new_vg_name string os
d-i partman-auto/expert_recipe string \
boot-root :: \
512 512 512 ext4 \
$primary{ } \
$bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /boot } \
. \
97280 97280 97280 ext4 \
$primary{ } \
$defaultignore{ } \
device{ /dev/nvme0n1 } \
method{ lvm } \
vg_name{ os } \
. \
5120 5120 5120 linux-swap \
$lvmok{ } \
in_vg{ os } \
lv_name{ swap } \
method{ swap } format{ } \
. \
91136 91136 91136 ext4 \
$lvmok{ } \
in_vg{ os } \
lv_name{ root } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
. \
0 1000000000 -1 free \
.
# This makes partman automatically partition without confirmation.
d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select Finish partitioning and write changes to disk
d-i partman/confirm boolean true
### 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/services-select multiselect security
d-i apt-setup/security_host string security.ubuntu.com
d-i apt-setup/security_path string /ubuntu
### Package selection
tasksel tasksel/first multiselect openssh-server
d-i pkgsel/update-policy select none
d-i pkgsel/upgrade select none
### Boot loader installation
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
### Finishing up the installation
d-i finish-install/reboot_in_progress note
## No password for sudoers
d-i preseed/late_command string in-target sed -i 's/^%sudo.*$/%sudo ALL=(ALL:ALL) NOPASSWD: ALL/g' /etc/sudoers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment