Nethence Newdoc Olddoc Lab Your IP BBDock  


Warning: those guides are mostly obsolete, please have a look at the new documentation.

UnixWindowsOracleObsoleteHardwareDIYMechanicsScriptsConfigs

PXE server with RHEL5,6,7
 
http://pbraun.nethence.com/doc/net/ftpinstallsrv.html
http://pbraun.nethence.com/doc/net/pxe.html
http://pbraun.nethence.com/doc/security/ssh_cluster.html
http://pbraun.nethence.com/doc/sysutils_linux/kickstart.html
 
Prerequesties
Make sure those packages are installed,
On RHEL,
rpm -q \
dhcp \
syslinux \
tftp-server \
| grep ^package
Note. it's "tftp-hpa" on Debian
 
On Slackware,
ll /var/log/packages/| grep dhcp
ll /var/log/packages/| grep sysli
ll /var/log/packages/| grep tftp
 
DHCP
Edit DHCP configuration,
On RHEL,
cd /etc/dhcp/
On Slackware,
cd /etc/
mv dhcpd.conf dhcpd.conf.dist
vi dhcpd.conf
assuming you've got two network interfaces (any identified network needs to be defined), like,
allow bootp;
ddns-update-style none;
allow unknown-clients;
 
subnet 10.0.0.0 netmask 255.255.252.0 {
}
 
subnet 10.8.8.0 netmask 255.255.255.0 {
range 10.8.8.100 10.8.8.199;
next-server 10.8.8.1;
filename "pxelinux.0";
}
Note. other examples here : /usr/share/doc/dhcp*/dhcpd.conf.sample
 
Check the configuration,
dhcpd -t -cf /etc/dhcp/dhcpd.conf
 
The Tftp server
Enable TFTP,
On RHEL,
ls -ld /tftpboot/
ls -ld /var/lib/tftpboot/
#rhel7,
#cd /
# ln -s var/lib/tftpboot
cd /etc/xinetd.d/
vi tftp
change,
disable = no
Note. server_args = -s /tftpboot on RHEL6
Note. server_args = -s /var/lib/tftpboot on RHEL7
 
On Slackware,
mkdir -p /tftpboot/pxelinux.cfg/
vi /etc/inetd.conf
tftp dgram udp wait root /usr/sbin/in.tftpd in.tftpd -s /tftpboot -r blksize
/etc/rc.d/rc.inetd restart
 
The PXELinux micro-kernel
Deploy the PXE micro-kernel, floppy loader, multiboot kernel loader and the menu tool,
on RHEL6,
mkdir -p /tftpboot/pxelinux.cfg/
#to boot netbsd cp /usr/lib/syslinux/mboot.c32 /tftpboot/
cp /usr/lib/syslinux/menu.c32 /tftpboot/
cp /usr/lib/syslinux/memdisk /tftpboot/
cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
#cp /usr/lib/syslinux/vesa* /tftpboot/
on RHEL7 and Slackware,
#to boot netbsd cp /usr/share/syslinux/mboot.c32 /tftpboot/
cp /usr/share/syslinux/memdisk /tftpboot/
cp /usr/share/syslinux/menu.c32 /tftpboot/
cp /usr/share/syslinux/pxelinux.0 /tftpboot/
#cp /usr/share/syslinux/vesa* /tftpboot/
 
Prepare a basic PXE configuration,
mkdir -p /tftpboot/pxelinux.cfg/
vi /tftpboot/pxelinux.cfg/default
like,
default menu.c32
prompt 0
menu title PXE
Note. we will add operating systems and installers to boot below.
 
Ready to go
Make sure you are going to start DHCPD on a dedicated network (maybe vlan tagged), not to conflict with an existing DHCP service.
 
Start the daemons,
service dhcpd restart
service xinetd restart
chkconfig dhcpd on
systemctl enable dhcpd
chkconfig xinetd on
systemctl enable xinetd
 
Note. If you need to listen on a specific network interface, on rhel7,
systemctl stop dhcpd
systemctl disable dhcpd
chmod +x /etc/rc.local
vi /etc/rc.local
/usr/sbin/dhcpd -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd ens224 
 
Slackware Linux 64-bit installer and rescue
Provide the Slackware installer e.g.,
mkdir -p /tftpboot/slackware64/
cd /tftpboot/slackware64/
wget ftp://ftp.lip6.fr/pub/linux/distributions/slackware/slackware64-14.1/kernels/huge.s/bzImage
wget ftp://ftp.lip6.fr/pub/linux/distributions/slackware/slackware64-14.1/kernels/huge.s/config
wget ftp://ftp.lip6.fr/pub/linux/distributions/slackware/slackware64-14.1/isolinux/initrd.img
 
PXE configuration,
vi /tftpboot/pxelinux.cfg/default
add,
label Slackware64 Linux installer and rescue
kernel slackware64/bzImage
append initrd=slackware64/initrd.img load_ramdisk=1 prompt_ramdisk=0 rw SLACK_KERNEL=huge.s
Note. 14.1 ==> huge.s
Note. 31.1 ==> hugesmp.s
Note. vga=791 or 773 is not necessary since kernel-based video (KVM)
 
CentOS / RHEL installers and rescue
Provide the CentOS / RHEL installer e.g.,
release=RHEL7
mkdir -p /tftpboot/$release/
cd /tftpboot/$release/
cp /var/ftp/$release/images/pxeboot/{vmlinuz,initrd.img} .
#wget http://centos.mirrors.ovh.net/ftp.centos.org/6.7/os/i386/images/pxeboot/vmlinuz
#wget http://centos.mirrors.ovh.net/ftp.centos.org/6.7/os/i386/images/pxeboot/initrd.img
 
Prepare sub-menus,
cd /tftpboot/pxelinux.cfg/
cat >> default <<EOF
label RHEL
kernel menu.c32
append pxelinux.cfg/RHEL
 
label CentOS
kernel menu.c32
append pxelinux.cfg/CentOS
EOF
cat > RHEL <<EOF
menu title RHEL
 
EOF
cat > CentOS <<EOF
menu title CentOS
 
EOF
 
PXE configuration for RHEL/CentOS 7,
release=CentOS7
cat <<EOF
label $release rescue keymap=fr
kernel $release/vmlinuz
append initrd=$release/initrd.img keymap=fr ip=dhcp inst.repo=http://10.8.8.1/$release rescue
 
label $release installer keymap=fr
kernel $release/vmlinuz
append initrd=$release/initrd.img keymap=fr ip=dhcp inst.repo=http://10.8.8.1/$release text
 
label $release DANGEROUS AUTOMATED INSTALL keymap=fr
kernel $release/vmlinuz
append initrd=$release/initrd.img keymap=fr ip=dhcp inst.repo=http://10.8.8.1/$release ks=http://10.8.8.1/$release.cfg cmdline
 
EOF
Note. rhel7 if graphical does not work, add,
inst.xdriver=vesa
 
PXE configuration for RHEL/CentOS 4,5,6,
release=CentOS6
cat <<EOF
label $release rescue keymap=fr
kernel $release/vmlinuz
append initrd=$release/initrd.img lang=us keymap=fr ip=dhcp method=http://10.8.8.1/$release rescue
 
#using graphical installer here as the text one doesn't propose to install @base
label $release installer keymap=fr
kernel $release/vmlinuz
append initrd=$release/initrd.img lang=en_US.UTF-8 keymap=fr ip=dhcp method=http://10.8.8.1/$release
 
label $release DANGEROUS AUTOMATED INSTALL keymap=fr
kernel $release/vmlinuz
append initrd=$release/initrd.img lang=us keymap=fr ip=dhcp method=http://10.8.8.1/$release ks=http://10.8.8.1/$release.cfg text
 
EOF
Ref. about using method=: http://www.golinuxhub.com/2014/08/how-to-configure-pxe-boot-server-in.html
Note. eventuall use vga= on old releases
Note. for driver diskette add "dd"
Note. for static IP add "ip=IP netmask=NETMASK"
Note. installing RHEL4 on Opteron Proliants add "pci=nommconf"
Note. the times where you want text mode installation are over since RHEL7, the text mode anaconda has changed and I don't appreciated it now.
Note. this also works for RHEL7,
inst.stage2=http://10.8.8.1/RHEL7
#inst.stage2=hd:LABEL=RHEL-7.2\x20Server.x86_64
Note. for older RHEL versions, this is just enought,
label $release installer and rescue
kernel $release/vmlinuz
append initrd=$release/initrd.img text
 
Clean-up variables,
unset release
 
Refs.
21.1.1. Configuring a PXE Server for BIOS-based AMD64 and Intel 64 Clients: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Installation_Guide/chap-installation-server-setup.html
6.3. INSTALLING IN TEXT MODE: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Installation_Guide/sect-installation-text-mode-x86.html
Chapter 28. Boot Options: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/ap-admin-options.html#sn-bootoptions-installer
RED HAT ENTERPRISE LINUX 7.1 ANACONDA CUSTOMIZATION GUIDE: https://access.redhat.com/documentation/en/red-hat-enterprise-linux/version-7.1/red-hat-enterprise-linux-71-anaconda-customization-guide/
Yet another guide: http://www.jaimegago.com/network-install-via-pxe-and-tftp-on-rhel6-x86_64/
 
NetBSD installer and rescue
Provide the NetBSD PXE boot loader and installer e.g.,
cd /tftpboot/
mkdir NetBSD-7.0/
rsync -avz rsync://rsync.fr.netbsd.org/NetBSD/NetBSD-7.0/amd64/ NetBSD-7.0/amd64/
mkdir base/
tar xzf NetBSD-7.0/amd64/binary/sets/base.tgz -C base/
cp -i base/usr/mdec/pxeboot_ia32.bin .
rm -rf base/
 
PXE configuration, Solution 1,
vi /tftpboot/pxelinux.cfg/default
add,
label NetBSD/amd64 7.0 installer and rescue
kernel pxeboot_ia32.bin
 
And when trying to boot that one, enter this at the NetBSD boot loader prompt,
boot tftp:NetBSD-7.0/amd64/binary/kernel/netbsd-INSTALL.gz
 
Otherwise add this to your dhcpd.conf to point to netbsd-INSTALL instead of the default "netbsd" (tested, it works),
# This section allows dhcpd to respond with different answers
# for the different tftp requests for the bootloader and kernel.
if substring (option vendor-class-identifier, 0, 20)
= "PXEClient:Arch:00000" {
filename "pxelinux.0";
#filename "pxeboot_ia32.bin";
} elsif substring (option vendor-class-identifier, 0, 17)
= "NetBSD:i386:libsa" {
if filename = "boot.cfg" {
filename "tftp:boot.cfg";
} else if filename = "netbsd" {
filename "tftp:NetBSD-7.0/amd64/binary/kernel/netbsd-INSTALL.gz";
}
}
ref. x86/pxeboot (8) on netbsd amd64 7.0
apply,
On RHEL,
systemctl restart dhcpd
On Slackware,
pkill dhcpd
dhcpd -q eth0
 
This way, you only get one possible NetBSD installer, the one you define for filename "netbsd" in dhcpd.conf. There's also a way to use boot.cfg (installboot -e -o bootconf against the pxeboot binary) but I don't like the boot.cfg feature so much.
cp /usr/mdec/pxeboot_ia32.bin .
#installboot -v -e -o bootconf,modules pxeboot_ia32.bin
installboot -v -e -o bootconf pxeboot_ia32.bin
vi boot.cfg
Refs.
https://wiki.netbsd.org/tutorials/how_to_install__40__boot__41___netbsd_using_pxelinux/
https://mail-index.netbsd.org/netbsd-users/2011/04/19/msg008204.html
http://connect.ed-diamond.com/GNU-Linux-Magazine/GLMF-166/Creation-d-un-serveur-de-demarrage-PXE-sous-NetBSD-pour-installer-NetBSD
 
Solution 2, directly fom PXELINUX without netbsd pxe,
cp syslinux-6.03/bios/com32/mboot/mboot.c32 .
cp syslinux-6.03/bios/com32/lib/libcom32.c32 .
 
LABEL netbsd
COM32 mboot.c32
APPEND /netbsd-INSTALL.gz
ref. http://www.syslinux.org/wiki/index.php/Mboot.c32
unfortunately I get this error,
Invalid Multiboot image: neither ELF header nor a.out kludge found
 
NetBSD floppy (draft)
Provide the NetBSD installer e.g.,
mkdir -p /tftpboot/netbsdfloppy/
cd /tftpboot/netbsdfloppy/
wget ftp://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.0.2/i386/binary/kernel/netbsd-INSTALL_FLOPPY.gz
 
PXE configuration,
vi /tftpboot/pxelinux.cfg/default
add,
#label NetBSD 5 32-bit
#kernel mboot.c32
#append netbsd/...?
label NetBSD 5 32-bit install floppy
kernel memdisk
append netbsdfloppy/netbsd-INSTALL_FLOPPY.gz
 
Ubuntu Desktop PXE installer
Extract ubuntu-15.10-desktop-amd64.iso into a folder,
cd /tftpboot/
cp -R iso_mount_point 
ubuntu-15.10-desktop-amd64/
 
Fetch the netboot image,
cd /tftpboot/
mkdir ubuntu-netboot/
cd ubuntu-netboot/
wget "http://fr.archive.ubuntu.com/ubuntu/dists/wily/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux"
wget "http://fr.archive.ubuntu.com/ubuntu/dists/wily/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz"
#rsync -avz rsync://fr.archive.ubuntu.com/ubuntu/dists/wily/main/installer-amd64 .
#wget http://archive.ubuntu.com/ubuntu/dists/wily/main/installer-amd64/current/images/netboot/netboot.tar.gz
#mkdir netboot/
#tar xzf netboot.tar.gz -C netboot/
Ref. https://doc.ubuntu-fr.org/netboot
 
Create a dedicated Debian or Ubuntu mirror on a Debian or Ubuntu server.
 
Get a sample,
cat /tftpboot/netboot/ubuntu-installer/amd64/boot-screens/txt.cfg
 
Edit the PXE configuration,
vi /tftpboot/pxelinux.cfg/default
label ubuntu-wily-amd64
kernel ubuntu-netboot/linux
append initrd=ubuntu-netboot/initrd.gz
#append vga=788 initrd=ubuntu-netboot/initrd.gz --- quiet
 
TODO next step is preseed and/or kickstart
label linux
kernel ubuntu-installer/i386/linux
append ks=http://192.168.0.1/ks.cfg vga=normal initrd=ubuntu-installer/i386/initrd.gz ramdisk_size=16432 root=/dev/rd/0 rw --
 
Windows XP / 7 / 8 / 10
Solution 1, use memdisk and the ISO (either the install media, WinPE or an nLite image!) as initrd. Just like for the DOS floppy below.
http://higaknowit.com/2011/08/16/pxelinux-for-booting-of-iso-images/
http://reboot.pro/topic/8258-iso-mapping-with-memdisk-is-possible-now/
http://www.nliteos.com/download.html
 
Solution 2 for Windows XP, use bits and parts of those methods
Install Windows XP: http://diddy.boot-land.net/pxe/files/xp.htm
http://reboot.pro/topic/12479-pxelinux-and-windows-xp-installation/
 
Solution 3,
cd /tftpboot/
wget http://git.ipxe.org/releases/wimboot/wimboot-latest.zip
unzip wimboot-latest.zip
cp wimboot-2.5.1-signed/wimboot .
mkdir WinPE/ win7pro
mount -o loop win7pro.iso win7pro/
cd win7pro/
cp bootmgr boot/bcd boot/boot.sdi sources/boot.wim ../WinPE/
cd ../
vi /tftpboot/pxelinux.cfg/default
label WinPE
com32 linux.c32 howtogeek/libs/wimboot
append wimboot initrdfile=WinPE/bootmgr,WinPE/bcd,WinPE/boot.sdi,WinPE/boot.wim
umount win7pro/
Ref. http://www.howtogeek.com/162070/it-geek-how-to-network-boot-pxe-the-winpe-recovery-disk-with-pxelinux-v5-wimboot/
 
DOS floppy (Windows 98SE)
To boot legacy OS,
cd /tftpboot/
cp syslinux-6.03/bios/memdisk/memdisk .
 
Provide memdisk and a DOS bootdisk image,
mkdir -p /tftpboot/dos/
cd /tftpboot/dos/
wget http://lab.nethence.com/elge/floppy/win98sc.img
 
PXE configuration,
vi /tftpboot/pxelinux.cfg/default
add,
label Windows 98SE custom floppy
kernel memdisk
append initrd=dos/win98sc.img
 
Memtest86+
cd /tftpboot/
wget http://www.memtest.org/download/5.01/memtest86+-5.01.bin.gz
gunzip memtest86+-5.01.bin.gz
vi pxelinux.cfg/default
label Memtest86+
linux memtest86+-5.01.bin
ref. https://wiki.archlinux.org/index.php/syslinux#Using_memtest
 
Hardware Detection Tool
cd /tftpboot/
cp syslinux-6.03/bios/com32/hdt/hdt.c32 .
cp syslinux-6.03/bios/com32/cmenu/libmenu/libmenu.c32 .
cp syslinux-6.03/bios/com32/gpllib/libgpl.c32 .
vi pxelinux.cfg/default
label Hardware Detection Tool
kernel hdt.c32
ref. Hardware Detection Tools](http://www.syslinux.org/wiki/index.php/Hdt_(Hardware_Detection_Tool)#Download
 
XEN
LABEL xen
KERNEL mboot.c32
APPEND xen-3.2.gz dom0_mem=262144 --- vmlinuz-2.6.16-2-xen-686 console=tty0 root=/dev/md1 ro --- initrd.img-2.6.16-2-xen-686
FreeBSD
http://www.syslinux.org/wiki/index.php/Mboot.c32
 
SLES installer
Note. for SLES here's possible additional arguments,
ramdisk_size=65536
manual=1
showopts
textmode=1
Note. for SLES on VMware eventually add,
x11i=fbdev
 
Other systems
For a complete list of PXELINUX modules, see http://www.syslinux.org/wiki/index.php/Category:Comboot
 
References
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Installation_Guide/chap-installation-server-setup.html
http://syslinux.zytor.com/wiki/index.php/MEMDISK
http://wiki.centos.org/HowTos/PXE/PXE_Setup/Menus
http://www.netbsd.org/docs/network/netboot/tftpd.html
 

(obsolete, see the new doc)