Ubuntu 10.10 PXE live boot

This guide will setup Ubuntu 10.10 PXE live cd boot using NFS.

1. Setup your standard PXE server (tftp + dhcp) such that your files are under /tftpboot. Under CentOS, this is accomplished by

yum install tftp tftp-server xinetd syslinux
  • tftp/tftp-server is for the tftp server which is required to boot off PXE
  • xinetd is the super server which launches the tftp server when requested
  • syslinux contains pxelinux.0. This can also be found on some linux distribution images

2. Download the Ubuntu 10.10 iso.
3. Either mount the iso and extract the files to /tftpboot/images/ubuntu1010

 mount -o loop ubuntu-10.10-desktop-i386.iso  /mnt
cp -a /mnt/. /tftpboot/images/ubuntu1010
umount /mnt

or mount the iso directly to /tftpboot/images/ubuntu1010

mount -o loop ubuntu-10.10-desktop-i386.iso  /tftpboot/images/ubuntu1010

4. Add the following entry to your /tftpboot/pxelinux.cfg/default

label 2
        kernel /images/ubuntu1010/casper/vmlinuz
        append root=/dev/nfs boot=casper netboot=nfs nfsroot=10.1.1.6:/tftpboot/images/ubuntu1010 initrd=/images/ubuntu1010/casper/initrd.lz quiet splash --

5. Add the following entry to your /etc/exports

/tftpboot/images/ubuntu1010 10.1.1.0/24(async,no_root_squash,no_subtree_check,ro)
  • /tftpboot/images/ubuntu1010 – the location which is to be shared via NFS
  • 10.1.1.0/24 – the IPs which are allowed to access this share. Change this to match your network IPs.

6. Start/restart your NFS server
7. Your PXE boot should now work. When greeted with your pxe screen, enter ‘2’ (or whatever was set as your label in the pxe config file), and ubuntu should should begin booting.

Apache/HTTPd missing startup script

After manually compiling apache, there doesn’t seem to be a startup script provided. If that’s the case, use the following for the apache startup script (taken from http://www.faqs.org/docs/securing/chap29sec247.html). Place it in /etc/init.d/ with 755 chmod & root ownership and group.

If you compiled apache to a different location, outside of the usual PATH, you need to specify the full path to httpd in the script below.

#!/bin/sh
#
# Startup script for the Apache Web Server
#
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server. It is used to serve 
# HTML files and CGI.
# processname: httpd

# Source function library.
. /etc/rc.d/init.d/functions

# See how we were called.
case "$1" in
	start)
		echo -n "Starting httpd: "
		daemon /path/to/apache/bin/httpd -DSSL
		echo
		touch /var/lock/subsys/httpd
		;;
	stop)
		echo -n "Shutting down http: "
		killproc httpd
		echo
		rm -f /var/lock/subsys/httpd
		rm -f /var/run/httpd.pid
		;;
	status)
		status httpd
		;;
	restart)
		$0 stop
		$0 start
		;;
	reload)
		echo -n "Reloading httpd: "
		killproc httpd -HUP
		echo
		;;
	*)
		echo "Usage: $0 {start|stop|restart|reload|status}"
		exit 1
		esac

exit 0

Color-ize your scripts

To color your shell script output, you will need to echo out an escape sequence \033[$color1;$color2;$stylem.

You can specify one or more colors or styles, just delimit the colors or styles with a semicolon and end the list with a ‘m’.

Color is given as:

Color Foreground Background
black 30 40
red 31 41
green 32 42
yellow 33 43
blue 34 44
magenta 35 45
cyan 36 46
white 37 47

Style is given by:

Stle Code
Normal 0
Bold 1
Underline 4

Examples:
To print something as underlined green:

\033[33;4mYellow Underlined Text\033[0m

Example:
Yellow Underlined Text

To print something underlined, red, with a blue background:

\033[31;44;4mRed Underlined with a Blue Background Text\033[0m

Example:
Red Underlined with a Blue Background Text

To print the above without the underline, just remove the ‘4’

\033[31;44mRed with a Blue Background Text\033[0m

Example:
Red with a Blue Background Text