To set up a PXE boot server on CentOS 6 we need to install and configure the following
- DHCP Server
- TFTP Server
- Apache HTTP Server
- Local mirror of a Linux distribution (optional)
- UPDATE - 2013-04-21 - Added Fedora 18
- UPDATE - 2013-05-06 - Added Ubuntu 12.04
- UPDATE - 2013-08-16 - Added Fedora 19, removed Fedora 18
DHCP Server
yum install dhcp
Edit /etc/dhcp/dhcpd.conf
authoritative; ddns-update-style none; subnet 192.168.1.0 netmask 255.255.255.0 { option routers 192.168.1.1; option subnet-mask 255.255.255.0; option domain-name "example.com"; option domain-name-servers 192.168.1.201, 192.168.1.202; option time-offset 0; option ntp-servers 192.168.1.201, 192.168.1.202; default-lease-time 42000; max-lease-time 84000; next-server 192.168.1.203; # our TFTP server filename "/pxelinux.0"; pool { default-lease-time 900; max-lease-time 1800; range 192.168.1.11 192.168.1.199; } }
Enable and restart DHCP server
chkconfig dhcpd on
service dhcpd restart
TFTP Server
yum install tftp-server syslinux memtest86+
- syslinux is the package pxelinux.0 comes from
- memtest86+ is our memory test utility
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
mkdir -p /var/lib/tftpboot/images/memtest
cp /boot/memtest86+* /var/lib/tftpboot/images/memtest
PXE Configuration
- /var/lib/tftpboot/pxelinux.cfg/ will contain the default PXE configuration file
- /var/lib/tftpboot/images/ will contain the vmlinuz and initrd.img files of OSes we will want to install
mkdir /var/lib/tftpboot/pxelinux.cfg/
mkdir /var/lib/tftpboot/images/
/var/lib/tftpboot/pxelinux.cfg/default
default local timeout 600 prompt 1 display messages/help.msg F1 messages/help.msg F2 messages/images.msg F3 messages/rescue.msg F4 messages/special.msg label centos-6.5-64 kernel images/centos-6.5-64/vmlinuz append initrd=images/centos-6.5-64/initrd.img nomodeset ksdevice=bootif ip=dhcp ks=http://192.168.1.203/ks/centos-6.5-64.cfg ipappend 2 label fedora-19-64 kernel images/fedora-19-64/vmlinuz append initrd=images/fedora-19-64/initrd.img nomodeset ksdevice=bootif ip=dhcp ks=http://192.168.1.203/ks/fedora-19-64.cfg ipappend 2 label ubuntu-12.04-64 kernel images/ubuntu-12.04-64/linux append initrd=images/ubuntu-12.04-64/initrd.gz auto=true interface=eth0 hostname=ubuntu1204 url=http://192.168.1.203/ks/ubuntu-12.04-64.cfg label rescue kernel images/centos-6.5-64/vmlinuz append initrd=images/centos-6.5-64/initrd.img ksdevice=bootif ip=dhcp nomount rescue lang=en_US keymap=us method=http://192.168.1.203/dist/centos-6.5-64/ ipappend 2 label memtest kernel images/memtest/memtest label pxe pxe pxelinux.0 label local localboot 0
Enable and start TFTP Server
chkconfig tftp on
chkconfig xinetd on
service xinetd start
Apache Server
yum install httpd
chkconfig httpd on
service httpd start
Create Local Mirror of OSes
rsync -av --delete ftp.heanet.ie::pub/centos/6.5/os/x86_64/ /var/www/html/dist/centos-6.5-64/
rsync -av --delete ftp.heanet.ie::pub/fedora/linux/releases/19/Fedora/x86_64/os/ /var/www/html/dist/fedora-19-64/
Copy vzlinuz and initrd.img to /var/lib/tftpboot/images
mkdir /var/lib/tftpboot/images/centos-6.5-64
cp /var/www/html/dist/centos-6.5-64/images/pxeboot/vmlinuz /var/lib/tftpboot/images/centos-6.5-64/
cp /var/www/html/dist/centos-6.5-64/images/pxeboot/initrd.img /var/lib/tftpboot/images/centos-6.5-64/
mkdir /var/lib/tftpboot/images/fedora-19-64
cp /var/www/html/dist/fedora-19-64/images/pxeboot/vmlinuz /var/lib/tftpboot/images/fedora-19-64/
cp /var/www/html/dist/fedora-19-64/images/pxeboot/initrd.img /var/lib/tftpboot/images/fedora-19-64/
mkdir /var/lib/tftpboot/images/ubuntu-12.04-64
wget -O /var/lib/tftpboot/images/ubuntu-12.04-64/linux http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux
wget -O /var/lib/tftpboot/images/ubuntu-12.04-64/initrd.gz http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz
Kickstart and Preseed Files
And finally, here are the kickstart and preseed files