This is a great approach for easy deploying various distros over the network instead of using cd-rom/usb sticks. Since I already had a PI running as a torrent client/server and SAMBA why not implement some additional features? After some hours of hacking I manage to get the stuff working perfectly.
Let's get started. Please let me know if any step generates any issues.
Login as root
pi@pi ~ $sudo su -
root@pi:~#apt-get update
root@pi:~#apt-get install syslinux-common #This is for pxe booting files.
root@pi:~#apt-get install dnsmasq #Since I already have a router providing DHCP we need to use a proxy dhcp. dnsmasq is a great set of tools providing us with both tftp and proxy dhcp.
#mkdir /srv/tftpboot #root folder for pxe server.
root@pi:/srv/tftpboot#cp /usr/lib/syslinux/pxelinux.0 . #copy neccacary files for pxe boot.
root@pi:/srv/tftpboot#cp /usr/lib/syslinux/menu.c32 .
root@pi:/srv/tftpboot#mkdir pxelinux.cfg #folder for boot menu
root@pi:/srv/tftpboot/pxelinux.cfg
root@pi:/srv/tftpboot/#vim.tiny default #Menu file
Add following info for /srv/tftboot/pxelinux.cfg/default:
DEFAULT menu.c32
PROMPT 0
MENU TITLE PXE Boot
LABEL Test
MENU LABEL Test
Edit dnsmasq settings. Just add following lines at the end of the file.
# vim.tiny /etc/dnsmasq.conf
interface=eth0
dhcp-range=192.168.0.0,proxy
dhcp-boot=pxelinux.0
pxe-service=x86PC,"Booting from Network...",pxelinux
enable-tftp
tftp-root=/srv/tftpboot
dhcp-boot=pxelinux.0,servername,192.168.0.10
#restart dnsmasq to load config
root@pi:/srv/tftpboot#service dnsmasq restart
Try to boot a machine with pxe booting. Just to verify that's working.
Next we need to install nfs support for sharing the mounted iso files.
root@pi:/srv/tftpboot#apt-get install nfs-kernel-server
root@pi:/srv/tftpboot#mkdir /tftpboot/iso #this is where we put distro iso files
root@pi:/srv/tftpboot#mkdir /tftpboot/nfs #this is where we share nfs files
root@pi:/srv/tftpboot#mkdir /tftpboot/nfs/ubuntu #folder for ubuntu dist
Edit nfs shares
root@pi:/srv/tftpboot/#vim.tiny /etc/exports
Add following line:
/srv/tftpboot/nfs/ubuntu/ *(ro,sync,no_subtree_check)
root@pi:/srv/tftpboot# mount -o loop iso/ubuntu-13.04.iso nfs/ubuntu/ #mount iso file to nfs folder
mount: warning: nfs/ubuntu/ seems to be mounted read-only.
Then we need to enable rpcbind and restart nfs
root@pi:/srv/tftpboot#update-rc.d rpcbind enable && update-rc.d nfs-common enable
root@pi:/srv/tftpboot#service rpcbind start
root@pi:/srv/tftpboot#service nfs-kernel-server restart
Add following entry to the /srv/tftpboot/pxelinux.cfg/default
DEFAULT menu.c32
PROMPT 0
MENU TITLE PXE Boot
LABEL Test
MENU LABEL Test
LABEL Ubuntu
MENU LABEL ^Ubuntu 13.04
KERNEL nfs/ubuntu/casper/vmlinuz
APPEND initrd=nfs/ubuntu/casper/initrd.lz boot=casper netboot=nfs
nfsroot=192.168.0.180:/srv/tftpboot/nfs/ubuntu
Change IP to your server IP in default config file
That should be all. Works flawless for me(I/O performance of the PI is not awesome but definitely works fine). A really neat way of installing without using cd-rom or usb.