Welcome to Magical.DDNS.NeT Domain

Chat

Read Tao

Play Pacman

Software Repository

Linux Ditributions

Chatbot Source Code

SNES Emulator and Games

PS2 Emulator and Games

DNS Tools

Music

Docs

 

PXE Server Setup on Slackware
Updated: Jun 2, 2024
  Copy this script in your /etc/rc.d/rc.dhcpd file

########################################################################################
#!/bin/sh
#
# /etc/rc.d/rc.dhcpd
#
# Start/stop/restart the DHCP daemon.
#
# To make dhcpd start automatically at boot, make this
# file executable: chmod 755 /etc/rc.d/rc.dhcpd
#
#############################################

CONFIGFILE=”/etc/dhcpd.conf”
LEASEFILE=”/var/state/dhcp/dhcpd.leases”
INTERFACES=”eth0”
OPTIONS=”-q”

#############################################

dhcpd_start() {
if [ -x /usr/sbin/dhcpd -a -r $CONFIGFILE ]; then
echo “Starting DHCPD..”
/usr/sbin/dhcpd -cf $CONFIGFILE -lf $LEASEFILE $OPTIONS $INTERFACES
# /usr/sbin/dhcpd -q $INTERFACES
fi
}

dhcpd_stop() {
killall dhcpd
}

dhcpd_restart() {
dhcpd_stop
sleep 2
dhcpd_start
}

case “$1” in
‘start’)
dhcpd_start
;;
‘stop’)
echo “Stopping DHCPD..”

dhcpd_stop
;;
‘restart’)
dhcpd_restart
;;
*)
# Default is ‘start’, for backwards compatibility with previous
# Slackware versions. This may change to a .usage. error someday.
dhcpd_start
esac

########################################################################################

Copy this configuration to /etc/dhcpd.conf
# dhcpd.conf
#
# Configuration file for ISC dhcpd (see ‘man dhcpd.conf’)
#
allow booting;
allow bootp;

# Standard configuration directives…
default-lease-time 172800;
max-lease-time 604800;

subnet 10.10.10.0 netmask 255.255.255.0 {
range 10.10.10.2 10.10.10.254;
option subnet-mask 255.255.255.0;
option broadcast-address 10.10.10.255;
option domain-name “your.net.suffix”;
option domain-name-servers 10.2.127.228, 10.2.127.196;
option routers 10.10.10.1; #your gateway/router
}

# Group the PXE bootable hosts together
group {
# PXE-specific configuration directives…
next-server 10.10.10.100;
filename “pxelinux.0”;

# You need an entry like this for every host
# unless you’re using dynamic addresses
host moon {
hardware ethernet ff:14:4f:16:b1:4f;

fixed-address 10.10.10.150;
}
}

Set permissions and start the DHCPD

touch /var/state/dhcp/dhclient.leases

chmod 755 /etc/rc.d/rc.dhcpd
/etc/rc.d/rc.dhcpd start

Next download syslinux
wget https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.02.tar.bz2

Extract the file contents
tar -jxvf syslinux-6.02.tar.bz2
cd syslinux-6.02
make all | tee mylog.txt

Edit your /etc/inet.conf and uncomment this line below.
tftp dgram udp wait root /usr/sbin/in.tftpd in.tftpd -s /tftpboot -r blksize

mkdir /tftpboot
cd /tftpboot
cp ${HOME}/syslinux-6.02/bios/core/pxelinux.0 .
cp ${HOME}/syslinux-6.02/bios/com32/elflink/ldlinux/ldlinux.c32 .
cp ${HOME}/syslinux-6.02/bios/com32/menu/menu.c32 .
cp ${HOME}/syslinux-6.02/bios/memdisk/memdisk .

mkdir /tftpboot/pxelinux.cfg
touch /tftpboot/pxelinux.cfg/default
Now you can customize your default file.Follow the example below

# Default boot option to use
DEFAULT menu.c32
# Prompt user for selection
PROMPT 0
# Menu Configuration
MENU WIDTH 80
MENU MARGIN 10
MENU PASSWORDMARGIN 3
MENU ROWS 12
MENU TABMSGROW 18
MENU CMDLINEROW 18
MENU ENDROW 24
MENU PASSWORDROW 11
MENU TIMEOUTROW 20
MENU TITLE Main Menu

# Menus

# x64
LABEL x64
MENU LABEL Redhat 64Bit (x64)
KERNEL menu.c32
LINUX memdisk
LINUX rh64/images/pxeboot/vmlinuz
APPEND initrd=rh64/images/pxeboot/initrd.img
# SWx64
LABEL swx64
MENU LABEL Slackware 64Bit (x64)
KERNEL menu.c32
LINUX memdisk
LINUX slaxx64/kernels/huge.s/bzImage
APPEND initrd=slaxx64/isolinux/initrd.img
# LiveXP
LABEL LiveXP
MENU LABEL LiveXP
LINUX memdisk
APPEND raw iso initrd=livexp.iso
Note: please don’t load live ISO files larger than your RAM

mount your ISO images in the /tftpboot/ directory. Follow the example below.
mount -t iso9660 /images/SLAXx64.iso /tftpboot/slaxx64/

Set permissions and start the RPC
chmod 755 /etc/rc.d/rc.rpc
/etc/rc.d/rc.rpc start

Finally setup the NFS server
edit /etc/export and add the example paths
/tftpboot/rh64 *(ro,nohide,no_subtree_check,sync)
/tftpboot/slaxx64 *(ro,nohide,no_subtree_check,sync)

Set permissions and start NFS
chmod 755 /etc/rc.d/rc.nfsd
/etc/rc.d/rc.nfsd start

On the client machine you can mount the NFS exports to install via NFS
mount servername:/slaxx64 /mnt/nfsexport