1.安装dhcp、tftp-server、syslinux、xinetd。
yum install dhcp tftp-server syslinux xinetd
2.挂载ESXi ISO到/mnt
mount /dev/cdrom /mnt
3.修改dhcpd.conf
ddns-update-style interim;
allow booting;
allow bootp;
class "pxeclients" {
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
next-server 172.16.8.7;
filename = "pxelinux.0";
}
subnet 172.16.8.0 netmask 255.255.255.0 {
range 172.16.8.100 172.16.8.199;
}
4.启用tftp,修改/etc/xinetd.d/tftp中的disable = yes为disable = no
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
5.复制pxelinux.0到tftp根目录
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
6.新建目录/var/lib/tftpboot/pxelinux.cfg
mkdir /var/lib/tftpboot/pxelinux.cfg
7.复制ESXi ISO文件中的isolinux.cfg到/var/lib/tftpboot/pxelinux.cfg/下并改名default
cp /mnt/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
8.复制ESXi ISO中的全部文件到/var/lib/tftpboot/下
cp -a /mnt/* /var/lib/tftpboot/
9.复制syslinux自带的menu.c32到tftp根目录替换掉ESXI ISO里的menu.c32。
cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot/
10.重启dhcp、xinetd服务
systemctl restart dhcpd
systemctl restart xinetd
11.自定义安装脚本,安装httpd,编辑脚本ks.cfg
vim /var/www/html/ks.cfg
#
# Sample scripted installation file
#
# Accept the VMware End User License Agreement
vmaccepteula
# Set the root password for the DCUI and Tech Support Mode
rootpw mypassword
# Install on the first local disk available on machine
install --firstdisk --overwritevmfs
# Set the network to DHCP on the first network adapter
network --bootproto=dhcp --device=vmnic0
# A sample post-install script
%post --interpreter=python --ignorefailure=true
import time
stampFile = open('/finished.stamp', mode='w')
stampFile.write( time.asctime() )
12.编辑ESXi ISO复制过来的boot.cfg文件,添加kernelopt=ks=http://172.16.8.7/ks.cfg
vim /var/lib/tftpboot/boot.cfg
bootstate=0
title=Loading ESXi installer
timeout=5
kernel=/tboot.b00
kernelopt=ks=http://172.16.8.7/ks.cfg
modules=/b.b00 --- /jumpstrt.gz --- /useropts.gz --- /k.b00 --- /chardevs.b00 --- /a.b00 --- /user.b00 --- /uc_intel.b00 --- /uc_amd.b00 --- /sb.v00 --- /s.v00 --- /mtip32xx.v00 --- /ata_pata.v00 --- /ata_pata.v01 --- /ata_pata.v02 --- /ata_pata.v03 --- /ata_pata.v04 --- /ata_pata.v05 --- /ata_pata.v06 --- /ata_pata.v07 --- /block_cc.v00 --- /ehci_ehc.v00 --- /elxnet.v00 --- /emulex_e.v00 --- /weaselin.t00 --- /esx_dvfi.v00 --- /esx_ui.v00 --- /ima_qla4.v00 --- /ipmi_ipm.v00 --- /ipmi_ipm.v01 --- /ipmi_ipm.v02 --- /lpfc.v00 --- /lsi_mr3.v00 --- /lsi_msgp.v00 --- /lsu_hp_h.v00 --- /lsu_lsi_.v00 --- /lsu_lsi_.v01 --- /lsu_lsi_.v02 --- /lsu_lsi_.v03 --- /lsu_lsi_.v04 --- /misc_cni.v00 --- /misc_dri.v00 --- /net_bnx2.v00 --- /net_bnx2.v01 --- /net_cnic.v00 --- /net_e100.v00 --- /net_e100.v01 --- /net_enic.v00 --- /net_forc.v00 --- /net_igb.v00 --- /net_ixgb.v00 --- /net_mlx4.v00 --- /net_mlx4.v01 --- /net_nx_n.v00 --- /net_tg3.v00 --- /net_vmxn.v00 --- /nmlx4_co.v00 --- /nmlx4_en.v00 --- /nmlx4_rd.v00 --- /nvme.v00 --- /ohci_usb.v00 --- /qlnative.v00 --- /rste.v00 --- /sata_ahc.v00 --- /sata_ata.v00 --- /sata_sat.v00 --- /sata_sat.v01 --- /sata_sat.v02 --- /sata_sat.v03 --- /sata_sat.v04 --- /scsi_aac.v00 --- /scsi_adp.v00 --- /scsi_aic.v00 --- /scsi_bnx.v00 --- /scsi_bnx.v01 --- /scsi_fni.v00 --- /scsi_hps.v00 --- /scsi_ips.v00 --- /scsi_meg.v00 --- /scsi_meg.v01 --- /scsi_meg.v02 --- /scsi_mpt.v00 --- /scsi_mpt.v01 --- /scsi_mpt.v02 --- /scsi_qla.v00 --- /uhci_usb.v00 --- /vsan.v00 --- /vsanheal.v00 --- /vsanmgmt.v00 --- /xhci_xhc.v00 --- /tools.t00 --- /xorg.v00 --- /imgdb.tgz --- /imgpayld.tgz
build=
updated=0