Building a custom image for ESXi Lab (Maxtang NUC)


Introduction

I was fortunate to grab myself an Intel Nuc at VMware Explore 2022 Barcelona, which was kindly provided by Cohesity for vExperts. This article goes through some of the steps of preparing the Nuc for ESXi 8 and creating a custom image with the VMware Fling USB Native Driver configured.

Here are the specs of my NUC…

Sadly, my M2 slot is not functioning, so I had to adapt and use a fast USB drive. It is a free NUC, and one should (never look a gift horse in the mouth).

The tech specs for the NUC can be found here:

Configuring my PC for creating a custom ESXi ISO

The next step is to setup the prereqs for creating an ESXi ISO.

Python

The first step is to download Python and configure on your PC.

You can download this from here.

Tip: make sure you select “Add Python 3.7 to PATH” so that you install to:

C:\Users\<User>\AppData\Local\Programs\Python\Python37

You then need to update pip,

You can do this by downloading Pip here

Then Run:

C:\Users\<User>\AppData\Local\Programs\Python\Python37\Scripts> .\pip3.7.exe install six psutil lxml pyopenssl

You now need to reboot. As python requires a reboot before anything else.

Installing PowerCLI

For all those already using PowerCLI, it’s a simple case of using the Update-Module command to ensure you are on the latest version.

C:\Users\User> Update-Module VMware.PowerCLI -Scope CurrentUser

If you need to Install PowerCLI, you can use:

Install-Module VMware.PowerCLI -scope currentuser

I would also recommend setting the Invalid Certificate action to fail, which you can do as shown below:

C:\Users\<user>> Set-PowerCLIConfiguration -InvalidCertificateAction Fail

Once you have python and PowerCLI installed, you are ready to move on to the next step.

Preparing the ESXi custom image:

To save a lot of time and hassle, I found this script called ESXi-customizerPS.ps1, which takes care of the custom ESXi ISO creation (VMware PowerCLI ImageBuilder module/snapin.). Quick shout out to Andreas Peetz for creating this, and you can download a copy here: https://www.v-front.de/p/esxi-customizer-ps.html

Before you create your custom image, you need to download the fling for the “USB Network Native Drive for ESXi” which can be found here. Once downloaded, you will need to place this in a folder which is referenced when you run the ESI-CustomizerPS script. In my case, I created a folder called c:\temp\pkg:

Running the Script

Once you are ready, all you need to do now is run the following from PowerShell and your Custom ISO will be created using VMware PowerCLI ImageBuilder:

.\ESXi-CustomizerPS.ps1 -v80 -pkgdir c:\temp\pkg -nsc

Once complete, you should have a new ISO with the Fling added:

Installing ESXi and configuring Persisting USB NIC bindings

Once you have installed ESXi and configured the network, then reboot, your network config has gone. To fix this, you need to configure the USB adapter for persistence.

You can do this via the DCUI console. Read more here: https://kb.vmware.com/s/article/2148363

  1. Press Alt-F1 and login
  2. list the nics using “esxcfg-nics -l) You should see the vusb0 adapter. Take a note of the mac address.
  3. Set the mac address localcli system module parameters set -p “vusb0_mac=<<MAC Address>> usbBusFullScanOnBootEnabled=1” -m vmkusb_nic_fling
  4. Flip back to the DCUI, configure your network using the UI, and reboot.

Then you should be up and running.

Summary:

This blog post was to share some of the trials and tribulations of setting up my ESXi lab NUC and creating a custom ESXi image. It’s a bit fiddly setting up but once the PC is configured, it’s fairly straightforward after that. Remember to reboot the PC after configuring python.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: