cat << eot > /srv/tftp/pxelinux.cfg/default
# Default boot option to use
DEFAULT vesamenu.c32
# Prompt user for select
PROMPT 0
# Timeout value [10=1 second] for PXE menu
TIMEOUT 100
# Show menu only if CTRL key is pressed during dhcp query
# MENU SHIFTKEY 1
# Menu configuration
MENU WIDTH 78
MENU MARGIN 15
MENU ROWS 12
MENU PASSWORDMARGIN 16
MENU PASSWORDROW 13
MENU TIMEOUTROW 20
# MENU MASTER PASSWD $1$RKJ.jKLr$jWgDXiLlMwBVtWaxYvzEk1
MENU BACKGROUND #000000
MENU COLOR SEL 01;36;10 #000000 #eeeeee
MENU COLOR BORDER 30;44;10 #eeeeee #000000
MENU COLOR SCROLLBAR 30;44;10 #eeeeee #000000
MENU COLOR TITLE 01;36;44 #eeeeee #000000
MENU TITLE PXE Menu
LABEL local
MENU DEFAULT
MENU LABEL Local Boot
localboot 0
kernel chain.c32
append hd0
TEXT HELP
Boot from the local hard drive.
If you are unsure, select this option.
ENDTEXT
eot
apt install git make gcc liblzma-dev mkisofs isolinux
compile it
git clone git://git.ipxe.org/ipxe.git
create ipxe script
nano ~/menu.ipxe
and paste the following in it
#!ipxe
dhcp
params
param mac ${net0/mac}
chain http://${next-server}/ipxe/index.php##params
go to ipxe source directory
cd ipxe/src
make some changes to setting to include needed iPXE commands
sed -i s,'//#define IMAGE_MULTIBOOT','#define IMAGE_MULTIBOOT',g config/general.h
sed -i s,'//#define IMAGE_PXE','#define IMAGE_PXE',g config/general.h
sed -i s,'//#define IMAGE_SCRIPT','#define IMAGE_SCRIPT',g config/general.h
sed -i s,'//#define IMAGE_BZIMAGE','#define IMAGE_BZIMAGE',g config/general.h
uncomment IMAGE_MULTIBOOT, IMAGE_PXE, IMAGE_SCRIPT, IMAGE_BZIMAGE, IMAGE_PNG. In my setup they are on line 106-109 and 114, lines will vary so check before hand
sed -i '106,109 s,//,,' config/general.h
sed -i '114 s,//,,' config/general.h
uncomment useful commands to be added in iPXE from config/general.h file
sed -i s,'//#define IMAGE_MULTIBOOT','#define IMAGE_MULTIBOOT',g config/general.h
sed -i s,'//#define IMAGE_PXE','#define IMAGE_PXE',g config/general.h
sed -i s,'//#define IMAGE_SCRIPT','#define IMAGE_SCRIPT',g config/general.h
sed -i s,'//#define IMAGE_BZIMAGE','#define IMAGE_BZIMAGE',g config/general.h
sed -i s,'//#define NSLOOKUP_CMD','#define NSLOOKUP_CMD',g config/general.h
sed -i s,'//#define TIME_CMD','#define TIME_CMD',g config/general.h
sed -i s,'//#define VLAN_CMD','#define VLAN_CMD',g config/general.h
sed -i s,'//#define PXE_CMD','#define PXE_CMD',g config/general.h
sed -i s,'//#define REBOOT_CMD','#define REBOOT_CMD',g config/general.h
sed -i s,'//#define POWEROFF_CMD','#define POWEROFF_CMD',g config/general.h
sed -i s,'//#define PCI_CMD','#define PCI_CMD',g config/general.h
sed -i s,'//#define PARAM_CMD','#define PARAM_CMD',g config/general.h
sed -i s,'//#define PING_CMD','#define PING_CMD',g config/general.h
sed -i s,'//#define CONSOLE_CMD','#define CONSOLE_CMD',g config/general.h
sed -i s,'//#define IPSTAT_CMD','#define IPSTAT_CMD',g config/general.h
sed -i s,'//#define NTP_CMD','#define NTP_CMD',g config/general.h
uncomment useful commands to be added in iPXE from config/settings.h file, in my setup they are on line 13-16
sed -i '12,16 s,//,,' config/settings.h
now compile ipxe.iso file with embedded script menu.ipxe
make bin/ipxe.iso EMBED=~/menu.ipxe
compile ipxe.lkrn
make bin/ipxe.lkrn
copy ipxe.lkrn to tftp
cp ~/ipxe/src/bin/ipxe.lkrn /srv/tftp/krls/
setup tftp/pxe to load ipxe
cat << eot >> /srv/tftp/pxelinux.cfg/default
LABEL iPXE
MENU LABEL iPXE
kernel krls/memdisk keeppxe
append iso initrd=iso/ipxe.iso
text help
Boot to iPXE kernel
endtext
eot
cat << eot >> /srv/tftp/pxelinux.cfg/default
LABEL iPXE
MENU LABEL iPXE
kernel krls/ipxe.lkrn
append dhcp && chain http://\${next-server}/ipxe/index.php?mac=\${net0/mac}
text help
Boot to iPXE kernel
endtext
eot
Go up
That is it, your PXE server is ready with iPXE support. Now install Apache and php