Getting Ubuntu to PXEboot and install.



So today I was tasked with creating an entire system that does ubuntu automated installations, the first hurdle was actually getting ubuntu automated deployment, unfortunately there was a lot of misguidance laying around the net on the best way to approach this, so this is my attempt… it worked and I think it does the job…

####

# Howto unattended install ubuntu server LTS 10.4.2

# Written by Karl Kloppenborg

# For Crucial Paradigm and Public Parties.

# Copyright 2011 – ~ – Karl Kloppenborg

# notes, I am doing this on CENTOS5.5

# This tutorial is designed to show you how to make an automated unattended installation of 10.4.2 LTS server…

 

1) get a copy of the disk: ubuntu-10.04.2-server-i386.iso

I got mine from internode as we have peering with them!

 

wget http://mirror.internode.on.net/pub/ubuntu/releases/10.04/ubuntu-10.04.2-server-i386.iso

 

…store this in /root because that’s an awesome place.

 

2) Now we mount the disk to mnt

mount -o loop /root/ubuntu-10.04.2-server-i386.iso /mnt

3) Now we will configure the webserver

yum -y install httpd

default location of www is /var/www/html

4) so make a directory to serve this ubuntu stuff from:

mkdir /var/www/html/ubuntu

5) Now move everthing into the ubuntu directory, so from inside /mnt issue this:

cp -R * /var/www/html/ubuntu

This should buzz around for a while with flashy lights — this is to be expected.

now start httpd:

service httpd start

Now, assuming you’ve setup tftp and its verified working, do the following:

I have setup the following as my TFTP directory: /data/tftpboot/

6) Create the directory ubuntu inside this:

mkdir /data/tftpboot/ubuntu

7) now in the /mnt do the following:

cd install/netboot/

8) copy this contents to the tftp dir

cp -R  * /data/tftpboot/ubuntu

now assuming you have already configured DHCPD and its verified working you should dhcpd to the right pxelinux.0

9) edit dhcpd.conf in /etc/

make sure you add:

next-server 10.255.0.1;

filename “ubuntu/pxelinux.0”;

obviously adjust the configuration of next-server to suit your IP of tftpd location…. 😉

now restart dhcpd and verify you didn’t break config.

service dhcpd restart

10) now edit /data/tftpboot/ubuntu/pxelinux.cfg/default… delete what ever was in there and add:

default install

label install

menu label ^Install

menu default

kernel ubuntu-installer/i386/linux

append ramdisk_size=14984 locale=en_US console-setup/ask_detect=false  console-setup/layoutcode=us  netcfg/choose_interface=eth1 netcfg/get_hostname=testserver url=http://10.255.0.1/ubuntu-preseeds/preseed.cfg vga=normal initrd=ubuntu-installer/i386/initrd.gz — quiet

 

Note that append should be entirely one line…

11) then make another directory called ubuntu-preseeds inside webRoot.

mkdir /var/www/html/ubuntu-preseeds

 

Now we create the preseed and save it to this directory as preseed.cfg

I will attach this paste bin for it: http://pastebin.com/k02VMT1v

 

Boot and enjoy 😉

 

Cheers,

Karl Kloppenborg.

 


 


  • Greg

    You could also try chainloading PXELINUX with GPXE, which enables other features such as iSCSI (PXELINUX supports this with sanboot.c32, but needs to be chainloaded from GPXE for it to work). Supposedly people have also managed to get PXE ISO booting working to, by using GPXE to boot an iSCSI emulated DVD volume. Also with GPXE you can boot kernels through PXELINUX that are stored on a HTTP, FTP, NFS (and others!) volume, so assuming that the automated setup (e.g. kickstart) supports reading it’s repodata over the same protocol you could have the entire setup located on a single web server (rather than parts of it located in tftp).

    Additionally, PXELINUX can provide a really good boot time environment for deploying a almost anything and also can be used for booting handy dandy tools like memtest.

  • Good comment Greg,

    There’s so many different ways to skin the cat, for the specific setup I was going for, this proved good, mainly due to needing to write custom deployment preseeds every few minutes as machines booted for their installation….

    I might actually have a look at sanboot.c32, looks like an interesting boot module!

    –Karl.