PXE How-To

PXE Setup

Now, we’ll Install tftp, syslinux and dhcp

su -c ‘yum install tftp-server syslinux dhcp’

* Next, edit /etc/xinetd.d/tftp and change the value of “disable” to ‘no’

su -c ‘/etc/xinet.d/tftp’

* As the Redhat version of tftp uses tcp wrappers, edit /etc/hosts/allow and add “in.tftpd : ALL : ALLOW”

su -c ‘vim /etc/hosts.allow’

* then restart xinetd

su -c ‘service xinetd restart’

* Copy need files from syslinux to the tftpboot directory

su -c ‘cp /usr/lib/syslinux/pxelinux.0 /tftpboot’
su -c ‘cp /usr/lib/syslinux/menu.c32 /tftpboot’
su -c ‘cp /usr/lib/syslinux/memdisk /tftpboot’
su -c ‘cp /usr/lib/syslinux/mboot.c32 /tftpboot’
su -c ‘cp /usr/lib/syslinux/chain.c32 /tftpboot’

* Create the directory for your PXE menus

su -c ‘mkdir /tftpboot/pxelinux.cfg’

* Create a base directory for images. Create directories for each Fedora release you are supporting. In this case, I’ve decided to have arch/release, but you can vary this to suit your own needs

su -c ‘mkdir -p /tftpboot/images/Fedora/i386/5′
su -c ‘mkdir -p /tftpboot/images/Fedora/i386/6′
su -c ‘mkdir -p /tftpboot/images/Fedora/i386/7′
su -c ‘mkdir -p /tftpboot/images/Fedora/x86_64/6′
su -c ‘mkdir -p /tftpboot/images/Fedora/x86_64/7′

* For each “Release” and “ARCH” Copy vmlinuz and initrd.img from /images/pxeboot/ directory on “disc 1″/DVD of that $Release/$ARCH to /tftpboot/images/fedora/$ARCH/$RELEASE/

* Now, edit your /etc/dhcpd.conf and add the following lines (Note: xxx.xxx.xxx.xxx is the IP address of your PXE server.)

su -c ‘vim /etc/dhcpd.conf’

with

allow booting;
allow bootp;
option option-128 code 128 = string;
option option-129 code 129 = text;
next-server xxx.xxx.xxx.xxx;
filename “/pxelinux.0/”;

Restart DHCP server

su -c ‘service dhcpd restart’

Now, we’ll create a simple menu for the clients;

su -c ‘vim /tftpboot/pxelinux.cfg/default’

with;

default menu.c32
prompt 0
timeout 300
ONTIMEOUT local

MENU TITLE PXE boot Menu

LABEL Fedora 7 x86_64 NO KS eth0
MENU LABEL Fedora 7 x86_64 NO KS eth0
KERNEL images/fedora/x86_64/7/vmlinuz
APPEND ks initrd=images/fedora/x86_64/7/initrd.img ramdisk_size=100000 ksdevice=eth1 ip=dhcp url –url http://xxx.xxx.xxx.xxx/path/to/arch/files/or/kickstart

LABEL Fedora Core 6 i386 NO KS eth0
MENU LABEL FC6 i386 NO KS eth0
KERNEL images/fedora/i386/6/vmlinuz
APPEND ks initrd=images/fedora/i386/core6/initrd.img ramdisk_size=100000 ksdevice=eth1 ip=dhcp url –url http://xxx.xxx.xxx.xxx/path/to/arch/files/or/kickstart

Fire up your client’s and you should be good to go!

If you do experience any issues, you can use;

su -c ‘tail -f /var/log/messages’

To isolate the fault.