Search

ESXi Installer native CLI

VMware ESXi installation supports silent installation of the hypervisor on the bare metal using the KS.cfg file. The VMware knowledge article "About the Default ks.cfg Installation Script (vmware.com)" explains in details about syntax and possible locations for storing your KS.CFG file. When you go through this article or make your own ks.cfg file, you will come across a supported syntax (%pre and %include). Any script written in the ks.cfg file which is preceded by the %pre statement, is executed first by the installer before executing the rest of the answer file.


This neat feature comes in handy in situations where you would need to dynamically add configuration parameters into your ks.cfg file, which cannot be hardcoded into your ks.cfg file. Some examples of this would be: finding the appropriate vmnic for management network, assigning IP addresses from a DHCP server, finding the correct installation media etc.


What about the syntax of commands accepted under the %pre? Keep in mind, standard Linux commands will not work as the %pre is executed in the installer environment, and we do not have an actual installation on the server yet to be able to compile the full blown linux commands.


The %pre supports two interpreters; BusyBox and Python. Due to my comfort with BusyBox and shell syntaxes in general, I am going to explain on how to create your own BusyBox statements for use with the %pre statement.


Firstly, start by inserting your ESXi boot media into your server and boot off of that. Wait till the "Welcome to The Vmware ESXi X.X.X installation" screen appears:

Now, hit "Alt + F1" on your keyboard and you will be presented with the ESXi installer CLI environment.


Refer the BusyBox website "BusyBox" to find the syntax of commands as required by you. You can test these commands in the ESXi installer CLI environment. You can look for command syntaxes as per your requirement, test them in the installer CLI environment and then go ahead and add them to your KS.cfg file under the %pre section. Hit "Alt + F2" to exit the CLI.


Output from the execution of scripts under the %pre section can be added to the %include section in your KS.cfg file. In this way, you can add dynamic settings to your KS file instead of hard coding them!



46 views0 comments

Recent Posts

See All