PXE Server on Centos 7

For PXE server you need a DHCP Server, FTP/HTTP Server .

I hope that you have a working dhcp server on Linux/WIndow machine or on Switch/Router. You have to add "next server" to tell the dhcp server , if someone looking for PXE server then dhcp server will send your request to PXE server.

1. If you have a dhcp server on Linux Machine then add the following lines in the dhcp config file ....

allow booting;
allow bootp;
option option-128 code 128 = string;
option option-129 code 129 = text;
next-server 172.16.120.25;
filename "pxelinux.0";

2. Now configure TFTP and HTTP(to share files over network or web) server...

# yum install tftp-server http syslinux
# vi /etc/xinetd.d/tftp
   Change "disable" option to "no" from "yes"
# cp -r /usr/share/syslinux/* /var/lib/tftpboot/
# mkdir -p /var/lib/tftpboot/CENTOS7
# cp /SHARE/CENTOS/7/os/x86_64/images/pxeboot/vmlinuz /var/lib/tftpboot/CENTOS7/
# cp /SHARE/CENTOS/7/os/x86_64/images/pxeboot/initrd.img /var/lib/tftpboot/CENTOS7/
# mkdir /var/lib/tftpboot/pxelinux.cfg
#vi /var/lib/tftpboot/pxelinux.cfg/default

 default menu.c32
 prompt 0
 timeout 300
 ONTIMEOUT local
 menu title ## PXE Boot Menu ##

 label 1
 menu label ^1) Install Centos 7 Manual Installation
 kernel /CENTOS7/vmlinuz
 append initrd=/CENTOS7/initrd.img inst.repo=http://172.16.120.25/CENTOS/7/os/x86_64 devfs=nomount

 label 2

 menu label ^2) Boot from local drive localboot
 localboot 0

# systemctl start xinetd
# systemctl enable xinetd
# systemctl start httpd
# systemctl enable httpd
# firewall-cmd --zone=public --add-port=80/tcp --permanent
# firewall-cmd --add-service=http --permanent
# firewall-cmd --permanent --add-service=tftp
# firewall-cmd --reload


No comments:

Post a Comment