User Tools

Site Tools


setup_a_pxe_server

This is an old revision of the document!


PXE Server Setup

Debian / Ubuntu

Steps : * Simply download the following script (via wget ) * Run the script (using sh pxe_server.sh)

pxe_server.sh
#!/bin/sh
 
## WARNING: you must set the correct arch for the machines you are provisionning :
# ARCH could be one of : i386 | amd64 | etc.
ARCH=i386
DISTRO=debian
PXE_ROOT=/opt/pxe/$DISTRO-$ARCH
DNSMASQ_CONF=/opt/pxe/dnsmasq.conf
 
sudo apt-get install dnsmasq syslinux memtest86+
 
# Creation du repertoire servi par le builtin tftp de dnsmasq
mkdir -p $PXE_ROOT/pxelinux.cfg
cd $PXE_ROOT
 
# On fetch le kernel, le bootloader pxe et le ramdisk
export SITEFTP=ftp.fr.debian.org:/debian/dists/stable/main/installer-$ARCH/current/images/netboot/debian-installer/$ARCH
wget -c $SITEFTP/pxelinux.0 -O $PXE_ROOT/pxelinux.0
wget -c $SITEFTP/linux -O $PXE_ROOT/linux 
wget -c $SITEFTP/initrd.gz -O $PXE_ROOT/initrd.gz
 
# Config du bootloader
cat > $PXE_ROOT/pxelinux.cfg/default << EOF
DEFAULT lenny
LABEL lenny
        kernel linux
        append vga=normal initrd=initrd.gz --
TIMEOUT 0
EOF
 
# Config dnsmasq
cat > $DNSMASQ_CONF << EOF
interface=eth0
enable-tftp
tftp-root=$PXE_ROOT
dhcp-range=10.42.0.10,10.42.0.50,255.255.255.0
dhcp-boot=pxelinux.0,pxeserver,10.42.0.1
EOF
 
sudo ifconfig eth0 10.42.0.1 netmask 255.255.255.0
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
 
# Reload dnsmasq
sudo /etc/init.d/dnsmasq stop
sudo dnsmasq \
        --keep-in-foreground \
        --conf-file=$DNSMASQ_CONF \
        --log-facility=- 

CentOS

WARNING: This tutorial is in progress as I document my configuration process while trying to have a functionnal PXE server for network install. The idea is to run a virtual machine on my laptop to boot another computer on the LAN for PXE install.

  • Start ssh service on centOS for an easy access from the host machine
# service sshd start
  • EPEL repo config for centOS:
cd /tmp
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -Uvh epel-release-6*.rpm

Source

  • Update the system and install Cobbler
# yum update
# yum install cobbler
setup_a_pxe_server.1364047463.txt.gz · Last modified: 2013/03/23 15:04 by glenux