5-08 13 views
一、环境准备
1.1 镜像
准备工作,如果没有可以去“http://www.vmware.com”下载
1 |
ESXi 6.7 安装镜像 |
1.2 PXE环境
单台也可以哈,不强制必须要2台
1 2 |
文件服务器 192.168.59.129 PXE服务器 192.168.59.128 |
二、部署环境
2.1 文件服务器
2.1.1 关闭防火墙
1 2 3 4 |
[root@localhost ~]# systemctl disable firewalld [root@localhost ~]# systemctl stop firewalld [root@localhost ~]# sed -i '/SELINUX/s/enforcing/disabled/g' /etc/selinux/config [root@localhost ~]# reboot |
2.1.2 安装并配置中间件
1 2 3 |
[root@localhost ~]# yum install httpd system-config-kickstart -y [root@localhost ~]# systemctl enable httpd [root@localhost ~]# systemctl start httpd |
2.1.2 配置”文件服务器”
操作前先将两个镜像挂载到服务器中,此处我是分别挂载到“/mnt”和“/media”下
1 |
[root@localhost ~]# mkdir -p /var/www/html/esxi/6.7 ; cp -r /mnt /var/www/html/esxi/6.7/os |
2.1.3 ks脚本
ESXi 6.7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
[root@localhost ~]# vim /var/www/html/ksdir/esxi-67.cfg vmaccepteula rootpw --iscrypted $1$XxU20Fra$899RPyboZyHRoKAhJ8zfY. #url --url="http://192.168.59.129/esxi/6.7/os" # System language lang en_US # System authorization information #auth --useshadow --passalgo=sha512 # Use text mode install #text clearpart --firstdisk=local --overwritevmfs install --firstdisk=local --overwritevmfs #network --bootproto=static --ip=192.168.59.138 --gateway=192.168.59.2 --nameserver=192.168.59.2 --netmask=255.255.255.0 --device=vmnic0 network --bootproto=dhcp --device=vmnic0 reboot %post --interpreter=python --ignorefailure=true import time stampFile = open('/finished.stamp', mode='w') stampFile.write( time.asctime() ) %end %firstboot --interpreter=busybox vim-cmd hostsvc/enable_ssh vim-cmd hostsvc/start_ssh vim-cmd hostsvc/enable_esx_shell vim-cmd hostsvc/start_esx_shell # set clicense vim-cmd vimsvc/license --set=JU6YR-8E09H-1ZCT9-PL3Z0-1AUKX # enable password login (SSH) sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_confg # set static ip arr=$(esxcli network ip interface ipv4 address list | grep vmk0 ) IN=`echo $arr | cut -d ' ' -f 1` IP=`echo $arr | cut -d ' ' -f 2` NM=`echo $arr | cut -d ' ' -f 3` GT=`echo $arr | cut -d ' ' -f 6` esxcli network ip interface ipv4 set -t static -I $IP -N $NM -g $GT -i $IN %end |
1 |
[root@localhost ~]# chmod +r /var/www/html/ |
2.2 PXE 服务器
2.2.1 关闭防火墙
1 2 3 4 |
[root@localhost ~]# systemctl disable firewalld [root@localhost ~]# systemctl stop firewalld [root@localhost ~]# sed -i '/SELINUX/s/enforcing/disabled/g' /etc/selinux/config [root@localhost ~]# reboot |
2.2.2 安装并配置中间件
1 2 |
[root@localhost ~]# yum install dhcp tftp-server syslinux -y [root@localhost ~]# yum install httpd system-config-kickstart -y |
2.2.3 配置”PXE服务器”
2.2.3.1 配置tftp
1 2 3 4 5 6 |
[root@localhost ~]# mkdir /var/lib/tftpboot/pxelinux.cfg/ [root@localhost ~]# cp /usr/share/syslinux/{pxelinux.0,menu.c32} /var/lib/tftpboot/ [root@localhost ~]# scp root@192.168.59.129:/var/www/html/esxi/6.7/os /var/lib/tftpboot/esxi67/ [root@localhost ~]# scp root@192.168.59.129:/var/www/html/esxi/6.7/os/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default [root@localhost ~]# systemctl start tftp [root@localhost ~]# ss -tunlp |grep :69 |
2.2.3.2 配置dhcp
1 2 3 4 5 6 7 8 |
[root@localhost ~]# vim /etc/dnsmasq.d/dhcp port=0 dhcp-range=192.168.59.0,proxy dhcp-boot=pxelinux.0 pxe-service=x86PC,'Network Boot',pxelinux [root@localhost ~]# systemctl enable dnsmasq [root@localhost ~]# systemctl start dnsmasq [root@localhost ~]# ss -tunlp |grep 67 |
2.2.3.3 配置引导菜单
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[root@localhost ~]# vim /var/lib/tftpboot/pxelinux.cfg/default default menu.c32 timeout 60 menu title CentOS Linux PXE Install label esxi6.7 menu default KERNEL esxi67/mboot.c32 APPEND -c esxi67/boot.cfg MENU LABEL Auto Install ESXi 6.7 label local menu label Boot from ^local drive localboot 0xffff menu end |
2.2.3.4 配置ESXi引导脚本
1 2 3 4 5 6 7 8 9 10 |
[root@localhost ~]# vim /var/lib/tftpboot/esxi67/boot.cfg bootstate=0 title=Loading ESXi installer #timeout=5 prefix=esxi67 #添加此行,此行为引导文件所在的上行目录,如果安装源文件是放在"/var/lib/tftpboot"目录下的,此行不需要修改 kernel=b.b00 kernelopt=ks=http://192.168.59.129/ksdir/esxi-67.cfg #修改此行,指定"kickstart"文件的位置 modules=jumpstrt.gz --- useropts.gz --- features.gz --- k.b00 --- chardevs.b00 --- user.b00 --- procfs.b00 --- uc_intel.b00 --- uc_amd.b00 --- vmx.v00 --- vim.v00 --- sb.v00 --- s.v00 --- ata_liba.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 --- bnxtnet.v00 --- brcmfcoe.v00 --- char_ran.v00 --- ehci_ehc.v00 --- elxiscsi.v00 --- elxnet.v00 --- hid_hid.v00 --- i40en.v00 --- iavmd.v00 --- igbn.v00 --- ima_qla4.v00 --- ipmi_ipm.v00 --- ipmi_ipm.v01 --- ipmi_ipm.v02 --- iser.v00 --- ixgben.v00 --- lpfc.v00 --- lpnic.v00 --- lsi_mr3.v00 --- lsi_msgp.v00 --- lsi_msgp.v01 --- lsi_msgp.v02 --- misc_cni.v00 --- misc_dri.v00 --- mtip32xx.v00 --- ne1000.v00 --- nenic.v00 --- net_bnx2.v00 --- net_bnx2.v01 --- net_cdc_.v00 --- net_cnic.v00 --- net_e100.v00 --- net_e100.v01 --- net_enic.v00 --- net_fcoe.v00 --- net_forc.v00 --- net_igb.v00 --- net_ixgb.v00 --- net_libf.v00 --- net_mlx4.v00 --- net_mlx4.v01 --- net_nx_n.v00 --- net_tg3.v00 --- net_usbn.v00 --- net_vmxn.v00 --- nhpsa.v00 --- nmlx4_co.v00 --- nmlx4_en.v00 --- nmlx4_rd.v00 --- nmlx5_co.v00 --- nmlx5_rd.v00 --- ntg3.v00 --- nvme.v00 --- nvmxnet3.v00 --- nvmxnet3.v01 --- ohci_usb.v00 --- pvscsi.v00 --- qcnic.v00 --- qedentv.v00 --- qfle3.v00 --- qfle3f.v00 --- qfle3i.v00 --- qflge.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_isc.v00 --- scsi_lib.v00 --- scsi_meg.v00 --- scsi_meg.v01 --- scsi_meg.v02 --- scsi_mpt.v00 --- scsi_mpt.v01 --- scsi_mpt.v02 --- scsi_qla.v00 --- shim_isc.v00 --- shim_isc.v01 --- shim_lib.v00 --- shim_lib.v01 --- shim_lib.v02 --- shim_lib.v03 --- shim_lib.v04 --- shim_lib.v05 --- shim_vmk.v00 --- shim_vmk.v01 --- shim_vmk.v02 --- smartpqi.v00 --- uhci_usb.v00 --- usb_stor.v00 --- usbcore_.v00 --- vmkata.v00 --- vmkfcoe.v00 --- vmkplexe.v00 --- vmkusb.v00 --- vmw_ahci.v00 --- xhci_xhc.v00 --- elx_esx_.v00 --- btldr.t00 --- weaselin.t00 --- esx_dvfi.v00 --- esx_ui.v00 --- lsu_hp_h.v00 --- lsu_lsi_.v00 --- lsu_lsi_.v01 --- lsu_lsi_.v02 --- lsu_lsi_.v03 --- native_m.v00 --- qlnative.v00 --- rste.v00 --- vmware_e.v00 --- vsan.v00 --- vsanheal.v00 --- vsanmgmt.v00 --- tools.t00 --- xorg.v00 --- imgdb.tgz --- imgpayld.tgz build= updated=0 |
三、开始自动安装
将要安装的系统接入到跟PXE同一网段,然后从网络启动就好
如果想赏钱,可以用微信扫描下面的二维码,一来能刺激我写博客的欲望,二来好维护云主机的费用; 另外再次标注博客原地址 itnotebooks.com 感谢!
楼主好,我看你是配置了一个http的文件服务器,但是我发现下面并没有用到这个文件服务器啊,麻烦说明下,谢谢。
引导文件和ks脚本中都会用到的