Search This Blog

2014-11-11

Network Ubuntu Install via PXE Using Preseed - Kickstart Alternative

Ubuntu has a method of automatic network installation similar to redhat's kickstart install.

It's called "debian-installer" and it is the recommended method of installing ubuntu automatically.

Similar to kickstart you have a preconfiguration file called "preseed" in which you answer questions asked by the installer.

You can either:
  1. Install ubuntu manually and export answers to questions
  2. Create answers to questions manually

#1 you can perform using:

# Generate a sample preseed.cfg with some default values you selected during manual install
apt-get install debconf-utils
debconf-get-selections --installer > preseed.cfg
debconf-get-selections >> preseed.cfg


Then you make this file available in the kickstart menu.

I've included a sample menu file (which points to the preseed) as well as the contents of a basic preseed file.
Menu File:

default linux

SERIAL 0 115200

label linux
kernel images/ubuntu/14.04/install/netboot/ubuntu-installer/amd64/linux
append initrd=images/ubuntu/14.04/install/netboot/ubuntu-installer/amd64/initrd.gz auto=true priority=critical interface=auto url=ftp://fbsd-ftp/images/ubuntu/14.04/preseed/sandvine.seed -- console=ttyS0,115200n8
IPAPPEND 2


Preseed File:

# Primary network interface:
d-i netcfg/choose_interface select auto

# Locale Configuration
d-i debian-installer/locale string en_US

# Set Keyboard to American English
d-i console-keymaps-at/keymap select American English
d-i debian-installer/keymap string us

# Set timezone
d-i time/zone string American/Toronto

# Do not make a user account
d-i passwd/make-user boolean false

# Assign the password for root
d-i passwd/root-password password sandvine
d-i passwd/root-password-again password sandvine

# Allow root login
user-setup-udeb passwd/root-login boolean true

# Partitioning
# Partition using LVM on the first and only detected disk
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/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean false
partman-lvm partman-lvm/device_remove_lvm boolean true
partman-lvm partman-lvm/confirm_nochanges boolean true
partman-lvm partman-lvm/confirm boolean true
unknown partman-lvm/confirm boolean true
partman-lvm partman-lvm/vgdelete_confirm boolean true

# Choose automatic partitioning recipes where automatic puts
# All configuration on the same partition
d-i partman-auto/choose_recipe select automic
# Complete partitioning without further confirmation
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

#Choose some additional packages to instal
d-i pkgsel/include string openssh-server


### Finishing up the installation
# During installations from serial console, the regular virtual consoles
# (VT1-VT6) are normally disabled in /etc/inittab. Uncomment the next
# line to prevent this.
d-i finish-install/keep-consoles boolean true

# Send command to pxeboot server to tell it to boot from HDD after imaging is successful
d-i preseed/late_command string /bin/echo "$(hostname -s)" | nc -w 3 lab-nfsbootlinux 2509

# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note


Ubuntu does have support for kickstart but there are some important features that may not be fully featured in kickstart that are available in debian installer. Ubuntu even has system-config-kickstart utility to build kickstart files but because of the lack of full functionality it does not end up being as useful as the more fully funcitoning debian installer.

References:
Serial Console - http://blather.michaelwlucas.com/archives/638
Package Install (openssh) - http://www.stratuslab.eu/fp7/doku.php/tutoral:examplepreseed.html
Remove LVM Parts - http://ubuntuforums.org/showthread.php?t=1505174
Debian Example Preseed - http://d-i.debian.org/manual/example-preseed.txt
Ubutntu Example Preseed - https://help.ubuntu.com/lts/installation-guide/example-preseed.txt
Ubuntu 12.04 Preseed Explained - https://help.ubuntu.com/12.04/installation-guide/i386/preseed-contents.html
Ubuntu 10.04 Preseed example - https://help.ubuntu.com/10.04/installation-guide/example-preseed.txt
Generate a preseed - http://searchitchannel.techtarget.com/feature/Performing-an-automated-Ubuntu-install-using-preseeding
Puppet and Preseed - http://ghantoos.org/2012/10/21/cocktail-of-pxe-debian-preseed-ipmi-puppet/
Add Console and debug to menu - http://christian.hofstaedtler.name/blog/2008/09/debian-installer-preseeding-autostart-from-pxe.html
Ubuntu 14.04 install bug - http://www.michaelm.info/blog/?p=1378
What you need to append to menu - https://saz.sh/2011/07/30/preseed-debian-squeeze-using-pxe/
Create User Accounts - https://help.ubuntu.com/community/Cobbler/Preseed
Debian links:
https://www.debian-administration.org/article/394/Automating_new_Debian_installations_with_preseeding
https://www.debian.org/releases/wheezy/i386/apbs04.html.en
https://www.debian.org/releases/wheezy/i386/apbs03.html.en

Official Documentation:
http://www.debian.org/releases/stable/i386/apb.html.en
https://wiki.debian.org/DebianInstaller/Preseed
http://searchitchannel.techtarget.com/feature/Performing-an-automated-Ubuntu-install-using-preseeding
http://www.debuntu.org/how-to-unattended-ubuntu-deployment-over-network-page-5-preseed-file/

New Docs:
http://web.theurbanpenguin.com/auto-installing-ubuntu-16-04/
https://www.debian.org/releases/stable/example-preseed.txt
http://hands.com/d-i/

How to get a post-install command working:
http://www.50ply.com/blog/2012/07/16/automating-debian-installs-with-preseed-and-puppet/
https://ubuntuforums.org/showthread.php?t=1977570


1 comment:

  1. Very useful...just a note
    'd-i partman-auto/choose_recipe select automic' must be atomic not Automic

    ReplyDelete

Note: Only a member of this blog may post a comment.