====== OS Install: PXE Boot ======
**General Information**
In order to install an OS via PXE boot, a TFTP and DHCP server are required.\\
Using PXE allows for clients to begin a network installation without any net-install ISO.
* Reference Source: http://www.tecmint.com/install-pxe-network-boot-server-in-centos-7/
**Checklist**
* Distro(s): Enterprise Linux 7
* Other: Installation Server Created (NFS/HTTP/FTP) that is hosting the install DVD and kickstart file
* Example: Using [[linux_wiki:os_install_bare_metal#netinstall_iso_prep|NFS as an Installation Server]]
----
====== TFTP Server ======
* Install the required packagesyum install tftp-server xinetd
* Allow TFTP access (set disable = no)vim /etc/xinetd.d/tftp
service tftp
{
....some other variables...
disable = no
....some other variables...
}
* Start and Enable xinetdsystemctl start xinetd
systemctl enable xinetd
* Allow through firewall (if enabled)firewall-cmd --permanent --add-service=tftp
firewall-cmd --reload
----
====== DHCP Server ======
* Install required packageyum install dhcp
* Edit DHCP config and customize per your networkvim /etc/dhcp/dhcpd.conf
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.254 ;
range 192.168.1.240 192.168.1.250 ;
next-server 192.168.1.150 ;
filename "pxelinux.0" ;
}
* subnet => specify the network
* netmask => mask for your network
* option routers => gateway for the network
* range => start and ending IP to hand out via DHCP
* next-server => IP of the TFTP server
* filename => file that should be offered to systems doing PXE boot (relative to the TFTP server's root)
* Start and enable DHCPsystemctl start dhcp
systemctl enable dhcp
----
====== Create PXE Content ======
Now that both required services are setup, it is time to create the PXE boot content to be handed out over TFTP.
* Install a required packageyum install syslinux
* Create the PXE Linux directory structuremkdir -p /var/lib/tftpboot/pxelinux.cfg
mkdir /var/lib/tftpboot/centos7/
* Copy the pxelinux.0 data filecp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
* Create the PXE Linux default config file (replace '' with actual NFS server IPvim /var/lib/tftpboot/pxelinux.cfg/default
default menu.c32
prompt 0
timeout 600
menu title ########## PXE Boot Menu ##########
label 1
menu label ^1) Install CentOS 7.2 x86-64
kernel centos7/vmlinuz
append initrd=centos7/initrd.img method=nfs::/iso/centos7.2-dvd/
* PXE Boot Menu Reference Source: https://wiki.centos.org/HowTos/PXE/PXE_Setup/Menus
* To include a splash image when doing PXE, copy the image from the local systemcp /boot/grub/splash.xpm.gz /var/lib/tftpboot/
* Copy the files (images/pxeboot/vmlinuz and initrd.img) from the install disk to /var/lib/tftpboot/centos7/mount -t iso9660 -o loop CentOS-7-x86_64-DVD-1511.iso /mnt
cp /mnt/images/pxeboot/vmlinuz /var/lib/tftpboot/centos7/
cp /mnt/images/pxeboot/initrd.img /var/lib/tftpboot/centos7/
* Restart dhcpd and xinetdsystemctl restart dhcpd
systemctl restart xinetd
\\
**The system is now ready to accept incoming PXE boot requests.**
/var/lib/tftpboot/ contains:
* centos7 (directory)
* pxelinux.0 (data file)
* pxelinux.cfg (directory)
* splash.xpm.gz (splash image)
/var/lib/tftpboot/centos7 contains:
* initrd.img (centos 7 initrd)
* vmlinuz (centos 7 boot kernel)
/var/lib/tftpboot/pxelinux.cfg contains:
* default (config file)
----