step by step configure pxe boot server in Centos 7 | PXE network boot server | pxe boot
PXE stand for Preboot eXecution Environment it works on Client-Server architecture and allows unattended or automated OS installation over the Network
Point to be noted :
This PXE Boot server configuration in Ubuntu 16.4,
PXE network boot server with Configure dnsmasq with DHCP and dnsmasq without dhcp,
pxe boot server we add centos 7 boot entry in default pxelinux.cfg directory via NFS and http,
We configure pxe boot with clonezilla iso and zip
CentOS iso pxeboot entry, Installing CentOS, Debian using network booting
Server IP = 172.17.20.100
Host name = pxe.linuxtopic.com
OS = CentOS 7
Step 1:
Install required packages
yum install tftp-server syslinux dnsmasq
Step 2:
Configure dnsmasq
cp /etc/dnsmasq.conf /etc/dnsmasq.conf-bk
Option 1 : Configure dnsmasq as existing dhcp on network
vi /etc/dnsmasq.conf
# DNS Options
port=0
interface=eth0,lo
# DHCP Options
dhcp-range=172.17.0.1,proxy
dhcp-option=vendor:PXEClient,6,2b
dhcp-no-override
# PXE
dhcp-boot=pxelinux.0
#pxe-prompt="Press F8 for menu.", 10
pxe-service=X86PC, "www.linuxtopic.com", pxelinux
# TFTP Options
enable-tftp
tftp-root=/var/lib/tftpboot
Option 2 : Configure dnsmasq with dhcp server
# DNS Options
port=0
interface=eth0,lo
# DHCP range-leases
dhcp-range= eth0,172.17.20.200,172.17.20.250,255.255.0.0,1h
# Gateway
dhcp-option=3,172.17.20.100
# DNS
dhcp-option=6,172.17.120.100, 8.8.8.8
# Broadcast Address
dhcp-option=28,172.17.255.255
# NTP Server
dhcp-option=42,0.0.0.0
# PXE
dhcp-boot=pxelinux.0
pxe-service=x86PC, "Linuxtopic.com", pxelinux
# Enable TFTP
enable-tftp
tftp-root=/var/lib/tftpboot
Explain :
port=0 - disable dns
interface=eth0,lo - Interfaces that the server should listen and provide services
dhcp-rang=172.17.20.100,proxy - existing dhcp server ip
OR
dhcp-range= eth0,172.17.199.200,172.17.199.250,255.255.0.0,1h - Dhcp IP Range
dhcp-option=3,172.17.199.199 - define gateway
dhcp-option=6,172.17.199.199, 8.8.8.8 - Define DNS
dhcp-option=28,172.17.255.255 - Broadcast Address
dhcp-option=42,0.0.0.0 - NTP Server
dhcp-option=vendor:PXEClient,6,2b - download the boot file immediately by disable multicast and broadcast discovery.
dhcp-boot=pxelinux.0 -
pxe-service=X86PC, "www.linuxtopic.com", pxelinux - Use x86PC for 32-bit/64-bit architectures and enter a menu description prompt under string quotes. Other values types can be: Intel_Lean_Client, IA32_EFI, _EFI, Alpha, Arc_x86, BC_EFI, Xscale_EFI and X86-64_EFI, PC98, IA64
enable-tftp - Enables the build-in TFTP server.
tftp-root=/var/lib/tftpboot - the location for all netbooting files.
Video Tutorial In Hindi
Video Tutorial In Hindi
Step 3:
Create directory and copy required file
mkdir /var/lib/tftpboot/pxelinux.cfg
cp -v /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot
cp -v /usr/share/syslinux/menu.c32 /var/lib/tftpboot
cp -v /usr/share/syslinux/memdisk /var/lib/tftpboot
cp -v /usr/share/syslinux/mboot.c32 /var/lib/tftpboot
cp -v /usr/share/syslinux/chain.c32 /var/lib/tftpboot
cp -v /usr/share/syslinux/vesamenu.c32 /var/lib/tftpboot/
ls -l /var/lib/tftpboot/
Step 4:
Create default file and add menu entry
vi /var/lib/tftpboot/pxelinux.cfg/default
default vesamenu.c32
prompt 0
timeout 50
# Local Hard Disk pxelinux.cfg default entry
LABEL 1
MENU LABEL ^1) Boot local hard drive
MENU AUTOBOOT
MENU DEFAULT
LOCALBOOT 0
Step 5:
Download Clonezilla zip File from official website and extract
https://clonezilla.org/downloads/download.php?branch=stable
Create Directory and Copy clonezilla zip
mkdir /var/lib/tftpboot/clonezilla
cd /var/lib/tftpboot/clonezilla
unzip clonezilla-live-2.5.5-38-amd64.zip
Add Clonezilla menu entry in pxelinux.cfg/defalut
vi /var/lib/tftpboot/pxelinux.cfg/default
# Clonezilla pxelinux.cfg default entry
LABEL 2
MENU LABEL ^2) Clonezilla Live
KERNEL clonezilla/live/vmlinuz
APPEND ramdisk_size=32768 initrd=clonezilla/live/initrd.img boot=live union=overlay username=user config components noswap edd=on nomodeset noeject locales=en_US.UTF-8 keyboard-layouts=NONE net.ifnames=0 ocs_live_extra_param="" ocs_live_keymap="NONE" ocs_live_batch="yes" ocs_lang="en_US.UTF-8" vga=788 ip=frommedia nosplash fetch=tftp://172.17.20.100/clonezilla/live/filesystem.squashfs
Centos 7 pxelinux.cfg default boot entry
Download / Copy CentOS 7 ISO in pxe boot server and mount on /mnt:
mount -o loop /tmp/CentOS-7-x86_64-Minimal-1708.iso /mnt/
Create Folder
mkdir /var/lib/tftpboot/data/centos7_64Bit
Note: If you want to install CentOS 32 bit edition, make a relevant directory called centos7_32Bit (Ex. /var/lib/tftpboot/data/centos7_32Bit).
Copy the ISO file contents to /var/lib/tftpboot/data/centos7_64Bit
cp -fr /mnt/* /var/lib/tftpboot/data/centos7_64Bit/
Set the proper permissions to the above directory.
chmod -R 755 /var/lib/tftpboot/data
Access data for Installation :
Option 1 : NFS Server
yum install nfs-server
echo "/var/lib/tftpboot/data *(rw)" >> /etc/exports
restart service
systemctl restart nfs-serversystemctl enable nfs-server
Check nfsmount
showmount -e 172.17.20.100
Option 2 : HTTP Server
yum install httpd
Create a apache configuration file for PXE server under /etc/httpd/conf.d/ directory:
cat > /tmp/pxeboot.conf << EOFAlias /pxeboot /var/lib/tftpboot/data<Directory /var/lib/tftpboot/data>Options Indexes FollowSymLinksRequire all granted</Directory>EOF
systemctl disable firewalldsystemctl stop firewalld
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/sysconfig/selinux
systemctl restart httpdsystemctl enable httpd
Now test http by access url
Add Centos 7 menu entry in pxelinux.cfg/defalut
vi /var/lib/tftpboot/pxelinux.cfg/default
# CentOS 7 pxelinux.cfg default entry
LABEL 3
MENU LABEL ^3) Install CentOS 7 - NFS
kernel data/centos7_64Bit/images/pxeboot/vmlinuz
append initrd=data/centos7_64Bit/images/pxeboot/initrd.img inst.stage2=nfs:172.17.20.100:/var/lib/tftpboot/data/centos7_64Bit quiet
# CentOS 7 pxelinux.cfg default entry
LABEL 4
MENU LABEL ^4) Install CentOS 7 - HTTP
KERNEL data/centos7_64Bit/images/pxeboot/vmlinuz
APPEND initrd=data/centos7_64Bit/images/pxeboot/initrd.img method=http://172.17.20.100/pxeboot/centos7_64Bit devfs=nomount
Restart DNSMASQ
systemctl restart dnsmasqsystemctl enable dnsmasq
Option 3: FTP Server
yum install vsftpdConfigure vsftpd
vi /etc/vsftpd/vsftpd.conf# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
# When SELinux is enforcing check for SE bool ftp_home_dir
local_enable=NO
#
# Uncomment this to enable any form of FTP write command.
write_enable=NO
# Activate logging of uploads/downloads.
xferlog_enable=YES
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=NO
# Add This in bottom
anon_root=/var/lib/tftpboot/data
anon_max_rate=2048000
systemctl restart vsftpdsystemctl enable vsftpd
Add Centos 7 menu entry in pxelinux.cfg/defalut
vi /var/lib/tftpboot/pxelinux.cfg/default
# CentOS 7 pxelinux.cfg default entry
LABEL 5
MENU LABEL ^5) Install CentOS 7 - FTP
KERNEL data/centos7_64Bit/images/pxeboot/vmlinuz
APPEND initrd=data/centos7_64Bit/images/pxeboot/initrd.img inst.repo=ftp://172.17.20.100:/centos7_64Bit
Now PXE Boot Server is Ready - Go to client side and Select first boot device "Network" in BIOS setting
Leave a Comment