Building a PXE implementation automation installation system

1. PXE working principle

share picture< /p>

Ø Client toDHCP on EN-US”>PXE Server sends IP address request message,DHCP detects whether Client is legal (mainly to detect Client NIC MAC address), if legal, return the of Client IP address, and will start the file pxelinux.0 is sent to Client

Ø Client sends to get TFTP on PXE Server lang=”EN-US”>pxelinux.0 to request a message, and TFTP receives the message before sending it to the Client Send the size information of pxelinux.0 to test whether the Client is satisfied. When the TFTP receives the consent size information sent back by Client, it will formally send it to Client span>Send pxelinux.0

Client executes the received pxelinux.0 File

Ø < /span> Client sends the local computer to TFTP Server Configuration information file (under the pxelinux.cfg directory of the TFTP service), TFTP sends the configuration file back to Client, and then Client performs follow-up according to the configuration file operate.

< !--[if !supportLists]-->Ø Client toTFTP Send Linux kernel request information, and TFTP will send the kernel file to Client

Ø Client sends root file request information to TFTP, TFTP receives the message and returns to the Linux root file system

Ø Client starts the Linux kernel

Ø Client download the installation source file, read the automated installation script

2. CentOS 7 builds PXE automation System

Install CentOS 7 through the PXE automation system built by CentOS 7

² Pre-installation preparation: turn off the firewall and < span lang="EN-US">SELINUX, DHCP server static IP

² Install the package

  # yum -y install httpd tftp-server dhcp syslinux system-config-kickstart

² Configuration< span lang="EN-US" >httpFile sharing service:

  # systemctl enable httpd

  # systemctl start httpd

  # mkdir -p /var/www /html/centos/7

  # mount /dev/sr0 /var/www/html/centos/7 ​ #Mount the centos7 installation CD to the httpd service directory

² ² Configurationtftp service

  # systemctl enable tftp.socket

< span lang="EN-US">  # systemctl start tftp.socket

² Configure the DHCP service

  #vim /etc/dhcp/dhcpd.conf

  option domain-name “example .com”;

  default-lease-time 600;

  max-lease-time 7200;

  subnet 192.168.100.0 netmask 255.255.255.0 {

    range 192.168.100.1 192.168.100.200;

    filename “pxelinux.0”;

    next- server 192.168.100.100;

  }

  # systemctl enable dhcpd

  # systemctl start dhcpd

< p class="MsoListParagraph" style="margin-left: 21.0pt; text-indent: -21.0pt; mso-char-indent-count: 0; mso-list: l0 level1 lfo1;"> ² Prepare relevant documents

  # yum -y install syslinux< /span>

  # mkdir /var/lib/tftpboot/pxelinux.cfg/

  # cp /usr/share/syslinux/{pxelinux.0,menu.c32} /var/lib/tftpboot/

  # cp /var/www/html/centos/7/isolinux/{vmlinuz,initrd.i mg} /var/lib/tftpboot/

  # cp /var/www/html/centos/7/isolinux/isolinux.cfg /var /lib/tftpboot/pxelinux.cfg/default

² Ready to start the menu

# vim /var/lib/tftpboot/pxelinux.cfg/default

< span lang="EN-US">default menu.c32

timeout 600

menu title PXE INSTALL MENU

label auto

  menu label Auto Install CentOS 7

  kernel vmlinuz

  append initrd=initrd.img ks=http://192.168.100.100/ks/centos7.cfg

label manual

  menu label Manual Install CentOS 7

  kernel vmlinuz

  append initrd=initrd.img inst. repo=http://192.168.100.100/centos/7

label local

< p class="MsoNormal">  menu default

  menu label ^Boot from local drive

  localboot 0xffff

Leave a Comment

Your email address will not be published.