Skip to content

Instantly share code, notes, and snippets.

@alexforster
Last active September 4, 2020 21:12
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexforster/09ed15414b05ed7e1c7ced40e7ee08f9 to your computer and use it in GitHub Desktop.
Save alexforster/09ed15414b05ed7e1c7ced40e7ee08f9 to your computer and use it in GitHub Desktop.
Ubuntu 16.04 Preseed
1) Format a USB stick as mbr w/ bootable/primary/active fat32 partition and install syslinux onto it
2) Copy these files onto the USB stick
http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/current/images/hd-media/initrd.gz
http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/current/images/hd-media/vmlinuz
http://old-releases.ubuntu.com/releases/16.04.0/ubuntu-16.04-server-amd64.iso
^ important part is to get the 16.04.0 iso when using dists/xenial/main initrd & vmlinuz OR to use the latest iso when from dists/xenial-updates/main
^ fwiw an apt-get upgrade is performed at the end of installation via preseed
4) Create syslinux.cfg on the USB stick
default install
label install
menu default
menu label ^Install
kernel vmlinuz
append vga=788 initrd=initrd.gz net.ifnames=0 biosdevname=0 auto-install/enable=true debconf/priority=critical netcfg/choose_interface=auto preseed/file=/hd-media/preseed.cfg
5) Create preseed.cfg on the USB stick – exercise left to reader
# regional setting
d-i debian-installer/language string en_US:en
d-i debian-installer/country string US
d-i debian-installer/locale string en_US
d-i debian-installer/quiet boolean false
d-i debian-installer/splash boolean false
d-i localechooser/supported-locales multiselect en_US.UTF-8
d-i pkgsel/language-packs multiselect en
d-i pkgsel/install-language-support boolean false
# keyboard selection
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/modelcode string pc105
d-i keyboard-configuration/layoutcode string us
d-i keyboard-configuration/variantcode string intl
d-i keyboard-configuration/xkb-keymap select us(intl)
d-i keyboard-configuration/xkb-keymap select us
d-i debconf/language string en_US:en
# network settings
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string server
d-i netcfg/get_domain string local
d-i netcfg/hostname string server.local
d-i netcfg/link_wait_timeout string 5
d-i netcfg/dhcp_timeout string 5
# mirror settings
d-i mirror/country string US
d-i mirror/http/mirror string us.archive.ubuntu.com
d-i mirror/http/directory string /ubuntu
# clock and timezone settings
d-i time/zone string America/New_York
d-i clock-setup/utc boolean true
d-i clock-setup/ntp boolean true
# user account setup
# credentials: root/root
d-i passwd/make-user boolean false
d-i passwd/root-login boolean true
d-i passwd/root-password-crypted password $6$MEyO2nI7q0tgBbd4$Zg/y4Sc149VWuq9yMhzgt54PLu7wMfZL.iC605RrIh15TB5AWDOWQ62Ok63PrtNSAp9fZL6mNJAthLQvsm41Y/
d-i user-setup/encrypt-home boolean false
d-i user-setup/allow-password-weak boolean true
# configure apt
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
tasksel tasksel/first multiselect standard, ubuntu-server, openssh-server
openssh-server openssh-server/permit-root-login boolean true
d-i pkgsel/upgrade select none
d-i pkgsel/update-policy select none
d-i pkgsel/updatedb boolean true
### partitioning
d-i partman/filter_mounted boolean false
d-i partman/unmount_active boolean false
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string lvm
d-i partman-auto/purge_lvm_from_device boolean true
d-i partman-auto-lvm/new_vg_name string system
d-i partman-auto/expert_recipe string \
boot-root :: \
1074 1 1074 ext2 \
$primary{ } \
$bootable{ } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext2 } \
mountpoint{ /boot } \
options/noatime{ noatime } \
. \
100% 2 100% linux-swap \
lv_name{ swap } \
$lvmok{ } \
method{ swap } \
format{ } \
. \
0 3 -1 ext4 \
lv_name{ root } \
$lvmok{ } \
method{ lvm } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ / } \
options/noatime{ noatime } \
.
d-i partman-basicmethods/method_only boolean false
d-i partman/choose_partition select finish
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-md/confirm boolean true
d-i partman-md/confirm_nooverwrite boolean true
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
# bootloader
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev string default
d-i debian-installer/add-kernel-opts string net.ifnames=0 biosdevname=0 audit=0 cgroup_enable=memory swapaccount=1
# finish installation
d-i finish-install/reboot_in_progress note
d-i finish-install/keep-consoles boolean false
d-i cdrom-detect/eject boolean true
d-i debian-installer/exit/halt boolean false
d-i debian-installer/exit/poweroff boolean false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment