/ubuntu-custom-iso

Create a custom Ubuntu installer

Primary LanguageShellApache License 2.0Apache-2.0

Create a custom installer with preseed, with UK choices and some credentials. I use this to re-image my test cluster machines. See https://help.ubuntu.com/community/InstallCDCustomization

This setup creates an "ubuntu" user, and an extra user.

To create the ISO, on Ubuntu Linux:

# for mkpasswd:
sudo apt-get --yes install whois

echo $USER > extra-user-username
echo "Martijn Koster" > extra-user-fullname
(printf "$USER:"; stty -echo; mkpasswd --stdin --method=sha-512; stty echo) > extra-user-passwd
cp ~/.ssh/id_rsa.pub extra-user-ssh-key
cp ubuntu-uk.seed.template ubuntu-uk.seed
password=$(<extra-user-passwd)
sed -i \
  -e 's,^\(d-i passwd/user-password-crypted password\).*,\1 '"$password," \
  -e 's,^\(d-i passwd/root-password-crypted password\).*,\1 '"$password," \
  ubuntu-uk.seed
sudo --validate
./build.sh
rm extra-user-passwd ubuntu-uk.seed

To write the resulting ISO to a USB stick on MacOS

Copy to the Mac:

scp ubuntu-16.04.3-server-auto-amd64.iso mak@crab.lan:ISO/

Then on the Mac:

diskutil list
diskutil unmountDisk /dev/disk4
diskutil list
# check that disk is the one you intend to overwrite
sudo dd if=/Users/mak/ISO/ubuntu-16.04.3-server-auto-amd64.iso of=/dev/rdisk4 bs=1m
diskutil eject /dev/disk4