Ernest G. Wilson II's Debian PXE Server Instructions

Debian PXE Boot - Adapted from various places including: http://www.debian-administration.org/articles/478


#####################
# Setup a TFTP Server - Optional, only needed if you don't have a TFTP server
#####################


# Install TFTP on Debian
apt-get -y install tftpd-hpa

# Edit the configuration file and turn on Daemon mode
nano /etc/default/tftpd-hpa


# Create the TFTP root directory
mkdir -p /var/lib/tftpboot

# Start TFTP Server
/etc/init.d/tftpd-hpa start


#####################
# Setup a DHCP Server - Optional, only needed if you don't have a DHCP server capable of scope options 66 (network boot server) and 67 (boot filename)
#####################

# http://www.linuxhelp.net/forums/Setup_Simple_Dhcp_Server_t4052.html
# You can use your existing MS DHCP server if you can add two scope options: http://support.citrix.com/article/CTX115094
# MS DHCP scope options 66 (network boot server=IP Address of TFTP server) and 67 (boot filename=pxelinux.0)


# Install a DHCP server on Debian
apt-get -y install dhcp3-server

# Edit the DHCP server configuration
nano /etc/dhcp3/dhcpd.conf


#####################
# Setup an NFS Server - Optional, only needed if you don't have an NFS Server and ONLY if you need this for boot files (Not needed currently)
#####################


# Install a NFS server on Debian
apt-get -y install nfs-kernel-server nfs-common portmap
# NFS exports from a server are controlled by the file /etc/exports
# If you make changes to /etc/exports on a running NFS server, make changes effective by issuing the command: exportfs -a

/etc/init.d/nfs-kernel-server restart

# Exporting Directories On The Server
mkdir /var/nfs
chown nobody:nogroup /var/nfs


# Read the manual on exports
man 5 exports

# Edit the exports
nano /etc/exports

# The no_root_squash option makes it that /home will be accessed as root

# Activate changes
exportfs -a

# Example mounting from an NFS client
# create the directories where we want to mount the NFS shares
mkdir -p /mnt/nfs/home
mkdir -p /mnt/nfs/var/nfs
# Mount remote NFS exports
mount 192.168.0.100:/home /mnt/nfs/home
mount 192.168.0.100:/var/nfs /mnt/nfs/var/nfs
# Verify mounts from client
df -h
mount
# Mounting NFS Shares At Boot Time from Client
nano /etc/fstab
192.168.0.100:/home /mnt/nfs/home nfs rw,sync,hard,intr 0 0
192.168.0.100:/var/nfs /mnt/nfs/var/nfs nfs rw,sync,hard,intr 0 0


#####################
# Setup PXE Linux on Debian (basic setup to get started)
#####################


# Create the required PXE Linux configuration directory
mkdir /var/lib/tftpboot/pxelinux.cfg

# Change to the TFTP root directory on Debian
cd /var/lib/tftpboot/

# Get PXE Linux
wget http://ftp.uk.debian.org/debian/dists/etch/main/installer-i386/current/images/netboot/debian-installer/i386/pxelinux.0


#####################
# Setup a Debian as a "Boot Option" on your TFTP server
#####################

# Create a "Boot" config
nano /var/lib/tftpboot/pxelinux.cfg/default


# Create a Debian directory for the i386 flavor
mkdir -p /var/lib/tftpboot/debian/etch/i386

# Change to the TFTP directory on Debian for the i386 flavor
cd /var/lib/tftpboot/debian/etch/i386

# Download the Debian i386 Network Boot files
wget http://ftp.uk.debian.org/debian/dists/etch/main/installer-i386/current/images/netboot/debian-installer/i386/linux
wget http://ftp.uk.debian.org/debian/dists/etch/main/installer-i386/current/images/netboot/debian-installer/i386/initrd.gz


#####################
# Setup a CentOS as a "Boot Option" on your TFTP server
#####################

# Add CentOS to the PXE choices - http://wiki.centos.org/HowTos/PXE/PXE_Setup
apt-get -y install syslinux
cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot/
cp /usr/lib/syslinux/menu.c32 /var/lib/tftpboot/
cp /usr/lib/syslinux/vesamenu.c32 /var/lib/tftpboot/
cp /usr/lib/syslinux/memdisk /var/lib/tftpboot/
cp /usr/lib/syslinux/mboot.c32 /var/lib/tftpboot/
cp /usr/lib/syslinux/chain.c32 /var/lib/tftpboot/

# Download the CentOS i386 Network Boot files
mkdir -p /var/lib/tftpboot/centos/5.2/i386
cd /var/lib/tftpboot/centos/5.2/i386

wget http://mirror.centos.org/centos/5/os/i386/images/pxeboot/initrd.img
wget http://mirror.centos.org/centos/5/os/i386/images/pxeboot/vmlinuz

# Add labels to the boot default
nano /var/lib/tftpboot/pxelinux.cfg/default

# You can specify your kickstart config file (if you desire) by using this append line instead (and your own web server):
append vga=normal initrd=centos/5.2/i386/initrd.img ramdisk_size=8192 root=/dev/ram0 ip=dhcp lang=us expert ksdevice=eth0 ks=http://YourWebServerIP/Your-kickstart.cfg method=http://mirror.centos.org/centos/5.2/os/i386/ --


#####################
# Setup a Ubuntu as a "Boot Option" on your TFTP server
#####################


# Add Ubuntu to the PXE choices
mkdir -p /var/lib/tftpboot/ubuntu/8.10/i386
cd /var/lib/tftpboot/ubuntu/8.10/i386

wget http://ubuntu.media.mit.edu/ubuntu/dists/intrepid/main/installer-i386/current/images/netboot/ubuntu-installer/i386/linux
wget http://ubuntu.media.mit.edu/ubuntu/dists/intrepid/main/installer-i386/current/images/netboot/ubuntu-installer/i386/initrd.gz

# Add a label to the boot default
nano /var/lib/tftpboot/pxelinux.cfg/default


#####################
# Add "Other Boot Options" on your TFTP server
#####################


# Make sure you install a copy of unzip
apt-get -y install unzip

# Add DOS 6.22 to the PXE choices
mkdir -p /var/lib/tftpboot/dos622
cd /var/lib/tftpboot/dos622

wget http://s93616405.onlinehome.us/bootdisk/622c.zip
unzip 622c.zip

# Add a label to the boot default
nano /var/lib/tftpboot/pxelinux.cfg/default




# Add Win98 to the PXE choices
mkdir -p /var/lib/tftpboot/win98
cd /var/lib/tftpboot/win98

wget http://s93616405.onlinehome.us/bootdisk/win98c.zip
unzip win98c.zip

# Add a label to the boot default
nano /var/lib/tftpboot/pxelinux.cfg/default




# Add Win98 SE to the PXE choices
mkdir -p /var/lib/tftpboot/win98se
cd /var/lib/tftpboot/win98se

wget http://s93616405.onlinehome.us/bootdisk/win98sc.zip
unzip win98sc.zip

# Add a label to the boot default
nano /var/lib/tftpboot/pxelinux.cfg/default





# Add DR DOS to the PXE choices
mkdir -p /var/lib/tftpboot/drdos
cd /var/lib/tftpboot/drdos

wget http://s93616405.onlinehome.us/bootdisk/drdflash.zip
unzip drdflash.zip

# Add a label to the boot default
nano /var/lib/tftpboot/pxelinux.cfg/default