Install & Configure PXE Boot Server with Kickstart
1] Install syslinux & tftp-server
[root@server ~]# yum install tftp-server
2] Enable syslinux at boot time
[root@server ~]# vim /etc/xinetd.d/tftp
edit the line no. 14
disable = no
:wq
3] Start service
[root@server ~]# service xinetd start
[root@server ~]# chkconfig xientd on
4] Install FTP service
[root@server ~]# yum install vsftpd
5] Start vsftpd
[root@server ~]# service vsftpd start
[root@server ~]# chkconfig vsftpd on
6] Install syslinux, require boot loader
[root@server ~]# yum install syslinux
7] Copy the needed files from syslinux to the tftpboot directory
[root@server ~]# cp -rvp /usr/share/syslinux/{pxelinux.0,menu.c32,memdisk,mboot.c32,chain.c32} /var/lib/tftpboot/
8] Create the directory for your PXE menus
[root@server ~]# mkdir /var/lib/tftpboot/pxelinux.cfg
9] Create different directory for each PXE image
[root@server ~]# mkdir –p /var/lib/tftpboot/images/centos6
10] Mount CD/DVD and copy it to FTP public directory
[root@server ~]# mount /dev/cdrom /mnt
[root@server ~]# cp -rvp /mnt/* /var/ftp/pub/
[root@server ~]# umount /mnt
11] Copy vmlinuz and initrd.img from FTP public directory
[root@server ~]# cp -rvp /var/ftp/pub/images/pxeboot/{initrd.img,vmlinuz} /var/lib/tftpboot/images/centos6/
12] Instal DHCP server
[root@server ~]# yum install dhcp
13] Configure DHCP server. Add following lines to your /etc/dhcp/dhcpd.conf
[root@server ~]# vi /etc/dhcp/dhcpd.conf
option domain-name "anup.co.in";
option domain-name-servers 192.168.1.1;
default-lease-time 600;
max-lease-time 7200;
allow booting;
allow bootp;
next-server 192.168.1.1;
filename “/pxelinux.0”;
subnet 192.168.1.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.1.100 192.168.1.200;
option routers 192.168.1.1;
}
14] Start dhcp service
[root@server ~]# service dhcpd start
[root@server ~]# chkconfig dhcpd on
15] Create a menu for PXE server for os selection on PXE loading
[root@server ~]# vi /var/lib/tftpboot/pxelinux.cfg/default
default menu.c32
prompt 0
timeout 50
MENU TITLE ANUP PXE Menu
LABEL CentOS 6.4 (Final)
MENU LABEL CentOS-6.4
KERNEL images/centos6/vmlinuz
append vga=normal initrd=images/centos6/initrd.img ramdisk_size=32768
ks=ftp://192.168.1.1/pub/ks.cfg
16] Now create KickStart file in FTP public directory
[root@server ~]# vi /var/ftp/pub/ks.cfg
#It starts the installation process
Install
#configure a connection to a FTP server to locate installation files
url --url ftp://192.168.1.1/pub/
#setup language and keyboard
lang en_US.UTF-8
keyboard us
#Get network info from DHCP server
network --device eth0 bootproto dhcp
#setup encrypted root password, you can take out the encrypted password from /etc/shadow file
rootpw --iscrypted $6$NF6F/Yng442eA8oL$c/sHM
#setup firewall and open ssh port 22
firewall --service=ssh
#sets up the Shadow Password Suite
#(--enableshadow), the SHA 512 bit encryption algorithm for password encryption
#(--passalgo=sha512), and authentication with any existing fingerprint reader.
authconfig --enableshadow --passalgo=sha512 --enablefingerprint
#The selinux directive can be set to --enforcing, --permissive, or --disabled
selinux --enforcing
#setup timezone
timezone America/Toronto
#The default bootloader is GRUB. It should normally be installed on the Master
#Boot Record (MBR) of a hard drive. You can include a --driveorder switch to specify
#the drive with the bootloader and an --append switch to specify commands for
#the kernel.
bootloader --location=mbr --driveorder=sda --append=”crashkernel=auto rhgb quiet”
#Clear the Master Boot Record
zerombr yes
#This directive clears all volumes on the sda hard drive. If it hasn’t been used before,
#--initlabel initializes that drive.
clearpart --all --drives=sda --initlabel
#Changes are required in the partition (part) directives that follow.
part /boot --fstype=ext4 --size=500
part / --fstype=ext4 --size=27500
part swap --size=1000
part /home --fstype=ext4 --size=1000
#reboot machine
reboot
#skip answers to the First Boot process
firstboot --disable
Test the PXE server:
* Make changes in the BIOS settings and boot client machine from network. OR just press F12 to boot from network.