文章目录
参考文档
官方参考文档
https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-esxi-installation/GUID-51BD0186-50BF-4D0D-8410-79F165918B16.html
这是esxi分区使用程序 使用方法
https://kb.vmware.com/s/article/1036609?lang=zh_CN#Resizing%20a%20partition
网友的介绍
https://www.zhangfangzhou.cn/pxe-kickstart-install-uefi-esxi-7.html
ESXI各版本硬件兼容性查询验证
http://www.vmware.com/resources/compatibility/search.php
esxi6 和 esxi7的ks模板内容
vmaccepteula
rootpw --iscrypted ${password}
install --firstdisk --overwritevmfs
#install --firstdisk --overwritevmfs --novmfsondisk # 这句表示不创建本地vmfs存储
network --bootproto=static --device=${mac_address} --ip=${dhcp_ip} --gateway=${dhcp_gateway} --nameserver=${name_server} --netmask=${dhcp_netmask} --hostname=${hostname}
# network --bootproto=static --device=vmnic0 --ip=10.53.220.199 --netmask=255.255.255.0 --vlanid=0 --gateway=10.53.220.1 --hostname=10.53.220.199 --nameserver=10.1.0.1
#设置授权
# vmserialnum --esx=5U4TK-DML1M-M8550-XK1QP-1A052
paranoid
%firstboot --interpreter=busybox
#%post --interpreter=python --ignorefailure=true
#启动远程ssh
vim-cmd hostsvc/enable_ssh
vim-cmd hostsvc/start_ssh
#启用 ESXi Shell (TSM)
vim-cmd hostsvc/enable_esx_shell
vim-cmd hostsvc/start_esx_shell
#启用 High Performance
esxcli system settings advanced set --option=/Power/CpuPolicy --string-value="High Performance"
#关闭 ipv6
esxcli network ip set --ipv6-enabled=0
#不加入体验
esxcli system settings advanced set -o /UserVars/HostClientCEIPOptIn -i 2
# 开启ssh密码登录
cat << EOF > /tmp/opensshd_password_login.sh
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
/etc/init.d/SSH restart
EOF
chmod +x /tmp/opensshd_password_login.sh
sh /tmp/opensshd_password_login.sh
rm -rf /tmp/opensshd_password_login.sh
%post --interpreter=busybox
#%post --interpreter=python --ignorefailure=true
#wget http://${next_server}/zjmf/ipxe/option/status/${hostname}/finish/100
#wget http://${next_server}/zjmf/ipxe/option/dhcp/stop_ipxe/${hostname}
#wget http://${next_server}/zjmf/ipxe/option/dhcp/stop_dhcp/${hostname}
reboot
esxi8 存在的问题
1、esxi8 默认不再支持老的CPU,安装会有告警,具体cpu型号 见下面文章 KB 82794,
# A、但是可以通过 在ks的install 行中添加 --forceunsupportedinstall 参数来忽略告警,
# B、或者可以在boot.cfg 的kernelopt=中 添加allowLegacyCPU=true
# 我采用的前者A,实测在pxe方式中B的方式不能成功,还报错
https://kb.vmware.com/s/article/82794
https://kb.vmware.com/s/article/82794?lang=zh_CN
2、esxi8 在bios模式下,有一些告警 ,见下面文章 KB 84233
https://kb.vmware.com/s/article/84233
3、若是uefi等问题,参考该文章
https://forum.ipxe.org/showthread.php?tid=8164
esxi8 的ks模板案例
# 1、install 中可用的参数
--ignoreprereqwarnings # 将忽略警告消息
--ignoreprereqerrors # 将忽略错误消息
--forceunsupportedinstall # 将忽略已弃用 CPU 的错误/警告消息
# 2、注意只有busybox解释器中有wget 这个工具,若是使用python解释器,这个没法用
%post --interpreter=busybox
wget http://${next_server}/zjmf/ipxe/option/status/${hostname}/finish/100
================分界线=====================
vmaccepteula
rootpw --iscrypted ${password}
install --firstdisk --overwritevmfs --forceunsupportedinstall
network --bootproto=static --device=${mac_address} --ip=${dhcp_ip} --gateway=${dhcp_gateway} --nameserver=${name_server} --netmask=${dhcp_netmask} --hostname=${hostname}
paranoid
%firstboot --interpreter=busybox
# 启动远程ssh
vim-cmd hostsvc/enable_ssh
vim-cmd hostsvc/start_ssh
# 启用 ESXi Shell (TSM)
vim-cmd hostsvc/enable_esx_shell
vim-cmd hostsvc/start_esx_shell
# 开启ssh的密码登录
cat << EOF > /tmp/opensshd_password_login.sh
/bin/sed -i 's/passwordauthentication no/passwordauthentication yes/g' /etc/ssh/sshd_config
/etc/init.d/SSH restart
EOF
chmod +x /tmp/opensshd_password_login.sh
sh /tmp/opensshd_password_login.sh
rm -rf /tmp/opensshd_password_login.sh
#启用 High Performance
esxcli system settings advanced set --option=/Power/CpuPolicy --string-value="High Performance"
#关闭 ipv6
esxcli network ip set --ipv6-enabled=0
#不加入体验
esxcli system settings advanced set -o /UserVars/HostClientCEIPOptIn -i 2
%post --interpreter=busybox
#wget http://${next_server}/zjmf/ipxe/option/status/${hostname}/finish/100
#wget http://${next_server}/zjmf/ipxe/option/dhcp/stop_ipxe/${hostname}
#wget http://${next_server}/zjmf/ipxe/option/dhcp/stop_dhcp/${hostname}
reboot
如果文章对你有帮助,欢迎点击上方按钮打赏作者
暂无评论