# ABORT # Make a ESXi Image with Realtek driver

はじめに

以前も ESXi を立てたんだけれど,このときのハードは Realtek でなかったので素のインストーラのまま問題なくインストールできた. が,このハードは Ubuntu を入れ直して人に譲ってしまったので手元にない.

heavymoon.hateblo.jp

たまたま別のハードが手に入ったので,これに ESXi を入れる. 今回は NIC が Reaktek なのでインストーラの修正が必要.

イメージの修正には PowerShell が必要になるが,一応 Windows 環境が手元に無いことになっているので Linux 上で PowerShell を動かす.

READ DOCUMENTS

作業を始める前に.とりあえずドキュメントを眺める.

www.vmware.com

2019-06-09現在,Ubuntu なら動くらしいので Ubuntu を使う.(Docker上で)

OS Type .NET Version PowerShell Version
Windows .NET Framework 4.5, 4.5.x, 4.6, 4.6.x or 4.7.x Windows PowerShell 4.0, 5.0, or 5.1
Ubuntu .NET Core 2.0 PowerShell Core 6.1.2
macOS .NET Core 2.0 PowerShell Core 6.1.2

なんとなく行けそう.そう思った.このときはまだ.

INSTALL PowerShell

手順は以下をトレース.

docs.microsoft.com

root@ubuntu # apt update
root@ubuntu # apt -y install wget software-properties-common unzip vim less

まずは便利ツールを入れる.

root@ubuntu # mkdir powershell
root@ubuntu # cd powershell
root@ubuntu # wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
root@ubuntu # dpkg -i packages-microsoft-prod.deb
root@ubuntu # add-apt-repository universe
'universe' distribution component is already enabled for all sources.
root@ubuntu # apt update
root@ubuntu # apt install powershell
root@ubuntu # pwsh 
PowerShell 6.2.1
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

debリポジトリ登録して PowerShell をインストールするだけ.

INSTALL PowerCli

root@ubuntu # cd powercli
root@ubuntu # wget https://vdc-download.vmware.com/vmwb-repository/dcr-public/182cbc08-0e2a-4ad0-8581-e6d57252aae4/b75762a3-3d24-41e0-a32d-ee982ecc2dd1/VMware-PowerCLI-11.2.0-12483598.zip
root@ubuntu # unzip VMware-PowerCLI-11.2.0-12483598.zip
root@ubuntu # pwsh
PS > Install-Module VMware.PowerCLI
PS >  Get-InstalledModule
Version              Name                                Repository           Description                                                                                                                          
-------              ----                                ----------           -----------                                                                                                                          
11.2.0.12483635      VMware.VimAutomation.Sdk            PSGallery            This Windows PowerShell module contains PowerCLI Sdk.                                                                                
11.2.0.12483627      VMware.VimAutomation.Common         PSGallery            This Windows PowerShell module contains functionality required by multiple PowerCLI modules.   
6.7.0.12483609       VMware.Vim                          PSGallery            This Windows PowerShell module contains PowerCLI Vim.                                         
11.2.0.12483642      VMware.VimAutomation.Cis.Core       PSGallery            This Windows PowerShell module contains PowerCLI Cloud Infrastructure Suite cmdlets.
11.2.0.12483638      VMware.VimAutomation.Core           PSGallery            This Windows PowerShell module contains Windows PowerShell cmdlets for managing vSphere.
11.2.0.12483605      VMware.VimAutomation.Srm            PSGallery            This Windows PowerShell module contains PowerCLI SRM cmdlets.
10.0.0.7893904       VMware.VimAutomation.License        PSGallery            This Windows PowerShell module contains PowerCLI cmdlets for managing VMware product licenses.
11.2.0.12483615      VMware.VimAutomation.Vds            PSGallery            This Windows PowerShell module contains PowerCLI VDS cmdlets.
11.2.0.12483614      VMware.VimAutomation.Vmc            PSGallery            This Windows PowerShell module contains PowerCLI VMC cmdlets.
11.2.0.12483633      VMware.VimAutomation.Nsxt           PSGallery            This Windows PowerShell module contains PowerCLI NSXT cmdlets.
10.0.0.7893921       VMware.VimAutomation.vROps          PSGallery            This Windows PowerShell module contains PowerCLI vROps cmdlets.
7.6.0.12680098       VMware.VimAutomation.HorizonView    PSGallery            This Windows PowerShell module contains Connect/Disconnect cmdlets for View API service.
11.0.0.10379994      VMware.VimAutomation.Cloud          PSGallery            This Windows PowerShell module contains PowerCLI Cloud cmdlets.
6.7.0.11233116       VMware.ImageBuilder                 PSGallery            This Windows PowerShell module contains PowerCLI ImageBuilder cmdlets.
6.7.0.11233116       VMware.DeployAutomation             PSGallery            This Windows PowerShell module contains PowerCLI Auto Deploy cmdlets.
11.2.0.12483611      VMware.VimAutomation.Storage        PSGallery            This Windows PowerShell module contains PowerCLI storage management cmdlets.
1.3.0.0              VMware.VimAutomation.StorageUtility PSGallery            This Windows PowerShell module contains utility scripts for storage.
6.5.1.7862888        VMware.VumAutomation                PSGallery            This Windows PowerShell module contains PowerCLI VUM cmdlets.
11.0.0.10380515      VMware.VimAutomation.Security       PSGallery            This Windows PowerShell module contains PowerCLI security management cmdlets.
11.2.0.12483619      VMware.VimAutomation.Hcx            PSGallery            This Windows PowerShell module contains PowerCLI HCX cmdlets.
11.2.0.12780525      VMware.PowerCLI                     PSGallery            This Windows PowerShell module contains VMware.PowerCLI

モジュールを拾ってきてインストールするだけ.

# NG # MAKE A CUSTOM ESXi

問題はここから...

ESXi-Customizer-PS-v2.6.0.ps1 を使う方法

ESXi のインストーラをカスタマイズするにあたり,よく記事になっているのは ESXi-Customizer-PS-v2.6.0.ps1 を使った方法.

この方法は.スクリプトの一部がPowerShell6系に対応していないためそのままでは実行できない.

Get-PSSnapin でコケる.

www.v-front.de

github.com

VMware.ImageBuilder を直接使う方法

ESXi-Customizer-PS-v2.6.0.ps1 は所詮ラッパー.ならば直接コマンドを叩けばいい.と思ったけれど,ImageBuilder は PowerShell Core edition に対応していないらしい.

PS > Add-EsxSoftwareDepot -DepotUrl ./update-from-esxi6.5-6.5_update02.zip
Add-EsxSoftwareDepot : The 'Add-EsxSoftwareDepot' command was found in the module 'VMware.ImageBuilder', but the module could not be loaded. For more information, run 'Import-Module VMware.ImageBuilder'.
At line:1 char:1
+ Add-EsxSoftwareDepot -DepotUrl ./update-from-esxi6.5-6.5_update02.zip
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (Add-EsxSoftwareDepot:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
PS > Import-Module VMware.ImageBuilder
Import-Module : The VMware.ImageBuilder module is not currently supported on the Core edition of PowerShell.
At line:1 char:1
+ Import-Module VMware.ImageBuilder
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : OperationStopped: (The VMware.ImageBui\u2026tion of PowerShell.:String) [Import-Module], RuntimeException
+ FullyQualifiedErrorId : The VMware.ImageBuilder module is not currently supported on the Core edition of PowerShell.,Microsoft.PowerShell.Commands.ImportModuleCommand

mkisofs で iso を直接編集する方法

docs.vmware.com

なんとなく iso ファイルは作れそうだけど,どうやって vib を iso にねじ込むのかわからん...

ひとまず詰んだ... わからん...