I'm going to describe the steps necessary to configure a Raspberry Pi (running on Raspbian Wheezy) to act as a PXE boot-server, offering several different Ubuntu flavors directly from their ISO images.
NOTE: In most cases, the DHCP is on the same machine, but in my case it's not: The DHCP is handled by a WRT54GL router running on OpenWRT (White Russian).
So, on the Raspberry Pi:
1) Install the required packages:
Code: Select all
apt-get install tftpd-hpa nfs-kernel-server inetutils-inetd
- "tFTP" (tiny FTP) is the protocol for accessing the very first files needed to boot. Once the boot-kernel is running, the rest of the communication is handled over NFS.
- "NFS" is required to access the operating-system data from the mounted ISOs over the network.
- "inetd" is used to start the tftp daemon only when a client makes a request to the tftp port.
The tftpd-hpa package installation will fail (See this Werkstatt-Post for more details). The Raspberry Pi is running a non-standard kernel (no IPv6 support), so you have to start tftp with IPv4 only:
Edit "/etc/default/tftpd-hpa" and add the "--ipv4" startup option. The resulting file should look like this:
Code: Select all
# /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure --ipv4"
In the section "Network boot" on Debian's Netinstall wiki page, download netboot.tar.gz (If unsure, use "i386").
Unpack the netboot.tar.gz somewhere.
4) Populate the tFTP boot folder:
On some (older?) systems it's "/var/lib/tftpboot", but on the Raspberry it's in "/srv/tftp".
This is the tftp boot folder.
Copy 2 files from the Debian's netboot.tar.gz over to "/srv/tftp/"
- debian-installer/i386/pxelinux.0
- debian-installer/i386/boot-screens/vesamenu.c32
In that folder create a file called "default". This is where your boot options will be configured.
5) Edit "/srv/tftp/pxelinux.cfg/default" and enter the following:
Code: Select all
DEFAULT vesamenu.c32
PROMPT 0
TIMEOUT 300
ONTIMEOUT localboot
MENU TITLE Kitschserver PXE Boot Menu
LABEL localboot
MENU LABEL Local ^HDD
LOCALBOOT 0
LABEL xubuntu_precise_32
MENU LABEL ^Xubuntu Live (12.04 32bit)
KERNEL iso-mounted/xubuntu-12.04.1-desktop-i386/casper/vmlinuz
APPEND root=/dev/nfs boot=casper netboot=nfs nfsroot=192.168.1.5:/srv/tftp/iso-mounted/xubuntu-12.04.1-desktop-i386 initrd=iso-mounted/xubuntu-12.04.1-desktop-i386/casper/initrd.lz splash --
LABEL xubuntu_precise_64
MENU LABEL ^Xubuntu Live (12.04 64bit)
KERNEL iso-mounted/xubuntu-12.04.1-desktop-amd64/casper/vmlinuz
APPEND root=/dev/nfs boot=casper netboot=nfs nfsroot=192.168.1.5:/srv/tftp/iso-mounted/xubuntu-12.04.1-desktop-amd64 initrd=iso-mounted/xubuntu-12.04.1-desktop-amd64/casper/initrd.lz splash --
Add the following line to "/etc/exports":
Code: Select all
/srv/tftp/iso-mounted/ *(ro,sync,no_wdelay,insecure_locks,no_root_squash,insecure,no_subtree_check,crossmnt)
Starting the nfs-kernel-server throws some errors, but they are IPv6 related, so they can be ignored:
It's good to verify if NFS is running and sharing the right folder(s). You can use the following command to do that:Stopping NFS kernel daemon: mountd nfsd.
Unexporting directories for NFS kernel daemon....
Exporting directories for NFS kernel daemon....
Starting NFS kernel daemon: nfsdrpc.nfsd: address family inet6 not supported by protocol TCP
mountdrpc.mountd: svc_tli_create: could not open connection for udp6
rpc.mountd: svc_tli_create: could not open connection for tcp6
rpc.mountd: svc_tli_create: could not open connection for udp6
rpc.mountd: svc_tli_create: could not open connection for tcp6
rpc.mountd: svc_tli_create: could not open connection for udp6
rpc.mountd: svc_tli_create: could not open connection for tcp6
.
Code: Select all
showmount -e <nfs_server>