yeziruo

利欲驱人万火牛 江湖浪迹一沙鸥

前言

本文将指引你在Linux下打包ESXi镜像。
以下操作均建议在容器中进行,避免对主工作空间造成影响。

部署环境

使用Debian 11的LXC容器。

部署Python 3.7

PowerCLI建议使用Python 3.7这个版本,故行之。

# 下载
wget https://www.python.org/ftp/python/3.7.16/Python-3.7.16.tar.xz
tar xvf Python-3.7.16.tar.xz && cd Python-3.7.16
# 预配置
apt install libssl-dev
./configure --enable-optimizations --prefix=/usr/local/python37 --with-ssl-default-suites=python --with-openssl=/usr
# 编译安装
make -j2
make install
# 软连接
ln -s /usr/local/python37/bin/python3.7 /usr/bin/python37
ln -s /usr/local/python37/bin/pip3.7 /usr/bin/pip37
# 实现兼容性
# 否则报不是可执行文件的错误
ln -s /usr/local/python37/bin/python3 /usr/local/python37/bin/python3.exe
# 安装依赖
pip37 install six psutil lxml pyopenssl

部署PowerShell

按微软提供的文档安装。

apt update  && apt install -y curl gnupg apt-transport-https
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/microsoft.list'
apt update && sudo apt install -y powershell

安装PowerCLI
# 进入 PowerShell
pwsh
# 查找
Find-Module -Name VMware.PowerCLI
# 安装
Install-Module -Name VMware.PowerCLI -Scope AllUsers
# 配置 Python 路径
Set-PowerCLIConfiguration -PythonPath /usr/local/python37/bin/python3.exe

以上步骤完成后,应重启容器,使环境变量生效。

下载打包用文件

前往https://customerconnect.vmware.com/zh/patch下载最新的bundle(需要登陆)。
前往https://vibsdepot.v-front.de/wiki/index.php/List_of_currently_available_ESXi_packages下载所需驱动。
前往https://github.com/VFrontDe-Org/ESXi-Customizer-PS下载打包用脚本。

# wget ......
wget https://raw.githubusercontent.com/VFrontDe-Org/ESXi-Customizer-PS/master/ESXi-Customizer-PS.ps1

目前较多使用的是ESXi 6.7,也是大部分社区包所支持的最高版本。
常用包如下:

net55-r8168: 提供 Realtek 8168/8111/8411/8118 网卡支持
net-igb: 提供大部分 Intel 网卡 支持
sata-xahci: 为不受官方支持的 SATA AHCI 控制器提供支持(即为一些PCIe转SATA扩展卡提供支持)


打包

# 这里要求写绝对路径
./ESXi-Customizer-PS.ps1 -izip /root/ESXi670-202207001.zip -pkgDir /root/drv/

因为反斜杠的问题,我们的镜像最终输出在根目录下,以root\开头。

23020901.png

参考

https://docs.vmware.com/cn/VMware-vSphere/7.0/com.vmware.esxi.install.doc/GUID-F02D0C2D-B226-4908-9E5C-2E783D41FE2D.html
https://www.v-front.de/p/esxi-customizer-ps.html
https://learn.microsoft.com/zh-cn/powershell/scripting/install/install-debian

暂无评论

正在回复ID为 ??? 的评论

© 2013-2022 yeziruo. All Rights Reserved. Start5 theme by yeziruo.

CC BY-NC-SA 3.0 CN