VMware --- 定制 esxi iso 安装包

1、构建实验环境

1.1 实验目的

因在为主机安装 Esxi 时,未能正确识别到硬盘、网卡信息。所以需要为 Esxi 镜像添加第三方提供的网卡、SATA 驱动

  • 网卡型号:realtek semiconductor Co. rtl8111/8168/8411 pci express gigabit ethernet controller
  • 硬盘型号:通过 SATA AHCI 接口连接的 adata sp580 120G SSD

1.2、实验机的环境准备

1.2.1、实验机系统规划:

本次实验使用的系统版本为:

Windows 7 旗舰版 Service Pack1

1.2.2、打包目录结构规划

├── vmware
│   ├── powercli
│   ├── iso
│   │   └── pkg
│   └── ESXi-Customizer-PS-v2.6.0.ps1

1.3、软件环境的准备

1.3.1、升级 powershell

因 Windows 7 自带的 powershell 的版本为 2.0,所以要将其升级到 4.0

下载链接:

https://www.microsoft.com/en-us/download/details.aspx?id=40855

按照网页指引下载合适的版本,此处我下载的是 Windows6.1-KB2819745-x64-MultiPkg.msu,使用默认配置进行安装。

注:

需要更改 powershell 的执行策略,详情可以参考 《VMware --- Win2008R2 实验机安装配置的简单说明》 的相关部分

1.3.2、安装 PackageManagement PowerShell Modules

下载链接:

https://www.microsoft.com/en-us/download/details.aspx?id=51451

下载后,使用默认配置进行安装

1.3.3、下载安装 VMware.PowerCLI

根据目录规划,powercli 目录来存储 VMware.PowerCLI 的安装包,我这边使用的是 E:\vmware\powercli,以管理员的身份,启动 powershell。

PS C:\Users\Administrator> Save-Module -Name vmware.powercli -path D:\vmware\powercli

NuGet provider is required to continue
PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet
 provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or
'C:\Users\Administrator\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by
 running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install
and import the NuGet provider now?
[Y] 是(Y)  [N] 否(N)  [S] 挂起(S)  [?] 帮助 (默认值为“Y”): Y
PS C:\Users\Administrator> Install-Module -Name vmware.powercli

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from
'PSGallery'?
[Y] 是(Y)  [A] 全是(A)  [N] 否(N)  [L] 全否(L)  [S] 挂起(S)  [?] 帮助 (默认值为“Y”): A

1.3.4、获取需要添加到镜像中的驱动文件

下载链接:

https://vibsdepot.v-front.de/wiki/index.php/Welcome

根据页面指引,找到驱动下载链接 【ESXi Software】-->>【List of currently available ESXi packages】

根据此次实验需求,下载以下两种驱动

  • 【NIC drivers】-->>【NIC drivers】-->>【Direct Download links】-->>【VIB File of version 8.045a】
  • 【Driver map files】-->>【sata-xahci】-->>【Direct Download links】-->>【VIB File of version 1.40】

将下载下来的驱动文件,放置在 E:\vmware\iso\pkg 中

注:

驱动文件有两种格式(zip 和 vib),这里我使用的是 vib 格式的

1.3.5、获取 ESXi-Customizer-PS 脚本

下载链接是:

https://www.v-front.de/p/esxi-customizer-ps.html

页面有简单的使用说明,使用前该脚本之前,可以先阅读一下

1.4、获取 Esxi 的镜像

这里我获取的是 offline bundle 格式的文件,以 esxi 6.5 为例演示

PS E:\vmware\> .\ESXi-Customizer-PS-v2.6.0.ps1 -v65 -ozip -outDir .\iso

This is ESXi-Customizer-PS Version 2.6.0 (visit https://ESXi-Customizer-PS.v-front.de for more information!)
(Call with -help for instructions)

Logging to C:\Users\ADMINI~1\AppData\Local\Temp\ESXi-Customizer-PS-10004.log ...

Running with PowerShell version 4.0 and VMware PowerCLI version 10.1.0.8344055

Connecting the VMware ESXi Online depot ... [OK]

Getting Imageprofiles, please wait ... [OK]

Using Imageprofile ESXi-6.5.0-20180804001-standard ...
(dated 07/31/2018 08:40:27, AcceptanceLevel: PartnerSupported,
For more information, see http://kb.vmware.com/kb/56545.)

Exporting the Imageprofile to 'E:\vmware\iso\ESXi-6.5.0-20180804001-standard.zip'. Please be patient ...


All done.

选项的简单说明

  • -v65:仅使用 ESXi 6.5 版本,忽略其它版本
  • ozip:输出一个离线 bundle 而不是安装用的 ISO
  • outDir:用于存储自定义 ISO 或离线 bundle 的目录(默认为脚本目录。如果指定,则日志文件也将在结束后移动到此处。)

注1:

因为大家都知道的原因,在线获取 Esxi 镜像的速度慢的令人怀疑人生,所以强烈火建议大家,如果有条件的话,通过全局代理的方式来获取。

2、生成 Esxi 安装镜像

网上提供的大多是直接在线完成驱动文件的加载,最后输出一个 ISO 安装镜像。还是因为网络的原因,我在这里拆分成了两步。将镜像文件与驱动文件都取回了本地,再做聚合。

PS E:\vmware> .\ESXi-Customizer-PS-v2.6.0.ps1 -iZip .\iso\ESXi-6.5.0-20180804001-standard.zip -pkgDir .\iso\pkg -outDir .\iso

This is ESXi-Customizer-PS Version 2.6.0 (visit https://ESXi-Customizer-PS.v-front.de for more information!)
(Call with -help for instructions)

Logging to C:\Users\ADMINI~1\AppData\Local\Temp\ESXi-Customizer-PS-10004.log ...

Running with PowerShell version 4.0 and VMware PowerCLI version 10.1.0.8344055

Adding base Offline bundle .\iso\ESXi-6.5.0-20180804001-standard.zip ... [OK]

Getting Imageprofiles, please wait ... [OK]

Using Imageprofile ESXi-6.5.0-20180804001-standard ...
(dated 07/31/2018 08:40:27, AcceptanceLevel: PartnerSupported,
For more information, see http://kb.vmware.com/kb/56545.)

Loading Offline bundles and VIB files from .\pkg ...
   Loading E:\vmware\iso\pkg\net55-r8168-8.045a-napi.x86_64.vib ... [OK]
      Add VIB net55-r8168 8.045a-napi [New AcceptanceLevel: CommunitySupported] [OK, added]
   Loading E:\vmware\iso\pkg\sata-xahci-1.40-1.x86_64.vib ... [OK]
      Add VIB sata-xahci 1.40-1 [OK, added]

Exporting the Imageprofile to 'E:\vmware\iso\ESXi-6.5.0-20180804001-standard-customized.iso'. Please be patient ...


All done.

3、启动与验证

你可能感兴趣的:(VMware --- 定制 esxi iso 安装包)