G9FFF


Creating unattended install of Ubuntu Server 16.04
--------------------------------------------------

Note. Based on [1][2]

Remaster a CD, ie, download a non graphical ubuntu installation ISO:

  ubuntu-16.04.1-server-amd64.iso

Insert into XUbuntu VM: automounted as 

  /media/virtu/Ubuntu-Server 16.04.1 LTS amd64/

Copy the relevant files to a different directory
         --------

  # mkdir -p /opt/ubuntuiso
  # cp -rT "/media/virtu/Ubuntu-Server 16.04.1 LTS amd64/" /opt/ubuntuiso

Note: To bypass the need to press enter on boot change the timeout 
      in /isolinux/isolinux.cfg: 
      
        timeout 1
        
      Note that a value of 1 represents 0.1 second.
      
Prevent the language selection menu from appearing

  # cd /opt/ubuntuiso
  # echo en > isolinux/lang

Use GUI program to add a kickstart file named ks.cfg

  # apt-get install system-config-kickstart
  # system-config-kickstart # save file to ks.cfg

To add packages for the installation, add a %package section to the ks.cfg kickstart file, append to the end of ks.cfg file something like this.

  %packages
  @ ubuntu-server
  openssh-server
  build-essential

This will install the ubuntu-server "bundle", and will add the openssh-server and build-essential packages.

Add a preseed file, to suppress other questions

  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
  d-i partman/confirm_nooverwrite boolean true

Set the boot command line to use the kickstart and preseed files

  # vi isolinux/txt.cfg

Search for

  label install
    menu label ^Install Ubuntu Server
    kernel /install/vmlinuz
    append  file=/cdrom/preseed/ubuntu-server.seed vga=788 initrd=/install/initrd.gz quiet --

Replace with

  append file=/cdrom/preseed/ubuntu-server.seed initrd=/install/initrd.gz ks=cdrom:/ks.cfg preseed/file=/cdrom/ks.preseed --
  
Now create a new iso

  # mkisofs -D -r -V "ATTENDLESS_UBUNTU" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /opt/autoinstall.iso /opt/ubuntuiso

That's it. You'll have a CD that would install an Ubuntu system once you boot from it, without requiring a single keystroke.

Copy created ISO to host

  > pscp -P 2222 virtu@127.0.0.1:/opt/autoinstall.iso .

---------------------

Links

1. http://askubuntu.com/questions/122505
   /how-do-i-create-a-completely-unattended-install-of-ubuntu

2. http://askubuntu.com/questions/263162             
   /how-do-i-remove-the-write-the-changes-to-the-disks-question-during-preseed


