Setting up a PXE server

A PXE server is very useful if you need to boot your client over network because you don't have a CD-ROM or floppy installed. This allows you to install your OS without the need of an USB-device attached to your PC. All you need is a network card with PXE functionality included.

The next steps describe how to setup your PXE server. You will need an DHCP server as well. I assume your DHCP server is already setup and functional.

tftpd

Install the needed packages (Debian Etch)

aptitude install tftpd-hpa lftp 

Enable the tftpd service: /etc/default/tftpd-hpa

#Defaults for tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /var/lib/tftpboot"
/etc/init.d/tftpd-hpa start

dhcpd

A sample DHPC config would look like this:

subnet 192.168.0.0 netmask 255.255.255.0 {
  range 192.168.0.30 192.168.0.60;
  option broadcast-address 192.168.0.255;
  option domain-name-servers 192.168.0.2;
  option domain-name "localdomain";
  option routers 192.168.0.1;
  filename "pxelinux.0";
  next-server 192.168.0.99;
}

The important options are

  • filename “pxelinux.0”;
  • next-server 192.168.0.99;

next-server is your PXE server IP.

setup the boot environment

Home of your tftpd server is /var/lib/tftpboot. Our directory tree will be setup like so:

|-- boot.msg
|-- centos
|   `-- 5.2
|       |-- i386
|       |   |-- initrd.img
|       |   `-- vmlinuz
|       `-- x86_64
|           |-- initrd.img
|           `-- vmlinuz
|-- debian
|   |-- etch
|   |   `-- i386
|   |       |-- initrd.gz
|   |       `-- linux
|   `-- lenny
|       |-- amd64
|       `-- i386
|           |-- initrd.gz
|           `-- linux
|-- menu.c32
|-- pxelinux.0
`-- pxelinux.cfg
    |-- centos.conf
    |-- default
    |-- default.bak
    |-- etch.conf
    |-- lenny.conf

Get the files for pxe-boot

syslinux
First install syslinux, because we will need some special files for our boot menu:

aptitude install syslinux

FIXME

Get the debian files needed:

# lenny first :-)

cd /var/lib/tftpdboot/lenny
lftp -c "open http://ftp2.de.debian.org/debian/dists/lenny/main/installer-i386/current/images/netboot/debian-installer/; mirror i386"

FIXME

Prepare the centos boot:
Download the iso-files from centos.org, then copy these on your tfptd-server.

# mount the 1st iso to extract vmlinux:
mount -o loop /srv/mirror/centos/5.3/x86_64/CentOS-5.3-x86_64-bin-1of7.iso /mnt
cp /mnt/isolinux/initrd.img /var/lib/tftpboot/centos/5.3/x86_64/
cp /mnt/isolinux/vmlinuz /var/lib/tftpboot/centos/5.3/x86_64/

FIXME

The boot menue

pxelinux.cfg/default

# 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 Netzwerk Boot Menue

MENU AUTOBOOT Starting Local System in # seconds

# Menus
# Localboot
LABEL local
   MENU LABEL Von lokaler ^Festplatte booten ...
   menu default
   localboot 0
   timeout 200
   TOTALTIMEOUT 9000

# i386
LABEL etch
   MENU LABEL Installiere: Debian ^Etch Linux
   KERNEL menu.c32
   APPEND pxelinux.cfg/etch.conf

# x64
LABEL lenny
   MENU LABEL Installiere: Debian ^Lenny
   KERNEL menu.c32
   APPEND pxelinux.cfg/lenny.conf

# x64
LABEL centos
   MENU LABEL Installiere: ^CentOS Linux
   KERNEL menu.c32
   APPEND pxelinux.cfg/centos.conf

pxelinux.cfg/etch.conf

# 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 Debian Etch Installation

# Return to Main Menu
LABEL MainMenu
MENU DEFAULT
MENU LABEL ^Zurueck zum Netzwerk Boot Hauptmenue
KERNEL menu.c32

#
# Blank boots
#

LABEL etch_i386_install
        MENU LABEL Etch default ^install (i386)
        kernel debian/etch/i386/linux
        append vga=normal initrd=debian/etch/i386/initrd.gz  --

LABEL etch_i386_expert
        MENU LABEL Etch ^expert install (i386)
        kernel debian/etch/i386/linux
        append priority=low vga=normal initrd=debian/etch/i386/initrd.gz  --

LABEL etch_i386_rescue
        MENU LABEL Etch ^rescue (i386)
        kernel debian/etch/i386/linux
        append vga=normal initrd=debian/etch/i386/initrd.gz rescue/enable=true --

pxelinux.cfg/lenny.conf

# 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 Debian Lenny Installation

# Return to Main Menu
LABEL MainMenu
MENU DEFAULT
MENU LABEL ^Zurueck zum Netzwerk Boot Hauptmenue
KERNEL menu.c32

#
# Blank boots
#

LABEL lenny_i386_install
        MENU LABEL Lenny default ^install (i386)
        kernel debian/lenny/i386/linux
        append vga=normal initrd=debian/lenny/i386/initrd.gz -- quiet

LABEL lenny_i386_expert
        MENU LABEL Lenny ^expert install (i386)
        kernel debian/lenny/i386/linux
        append priority=low vga=normal initrd=debian/lenny/i386/initrd.gz --

LABEL lenny_i386_rescue
        MENU LABEL Lenny ^rescue (i386)
        kernel debian/lenny/i386/linux
        append vga=normal initrd=debian/lenny/i386/initrd.gz rescue/enable=true -- quiet

LABEL lenny_i386_auto
        MENU LABEL Lenny ^automated install (i386)
        kernel debian/lenny/i386/linux
        append auto=true priority=critical vga=normal initrd=debian/lenny/i386/initrd.gz -- quiet

pxelinux.cfg/centos.conf

# 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 CentOS Installation

# Return to Main Menu
LABEL MainMenu
MENU DEFAULT
MENU LABEL ^Zurueck zum Netzwerk Boot Hauptmenue
KERNEL menu.c32

#
# Blank boots
#

LABEL CentOS_KS_install
        MENU LABEL Centos 5.2 ^Install mit Kickstart (i386)
        KERNEL centos/5.2/i386/vmlinuz
        APPEND ks=http://mirror.home.lan/centos/kickstart/ksdefault.cfg initrd=centos/5.2/i386/initrd.img ramdisk_s

LABEL CentOS_52_install
        MENU LABEL Centos 5.2 ^default install (i386)
        KERNEL centos/5.2/i386/vmlinuz
        APPEND initrd=centos/5.2/i386/initrd.img ramdisk_size=100000 ip=dhcp nfs --server=nfsserver.home.lan --dir=/srv/m
networking/pxe-server.txt · Last modified: 2012-03 by tb
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready