Setting up a local vSphere Hypervisor on VirtualBox

A step-by-step guide for ESXi 6.0

In this post, we’ll take a look at how ESXi can be installed and run on a VirtualBox host. What’s the point? To get more familiar with vSphere and test our infrastructure provisioning scripts and configuration files locally. Of course, you shouldn’t be running this setup in production.

Firstly, if you haven’t already, install VirtualBox; we need version 5.0.18 or better.

Download the free vSphere Hypervisor ISO from VMware’s website. Select verson 6.0, as the latest 6.5 doesn’t currently work on VirtualBox. You will need to log in with a valid VMware account.

Make sure you download version 6.0

Run VirtualBox and create a new virtual machine. Name it ESXi (or whatever you prefer), select Linux as its type, and Other Linux (64-bit) as the version.

Create a new Other Linux (64-bit) virtual machine

The virtual machine will need at least 4GB of memory.

You will need at least 4GB of RAM to run ESXi

Create a new virtual hard disk: select VDI as its file type and Fixed size its storage type. Size the disk according to your use case; I went with 20GB.

Be sure to allocate enough space for your VMs

We will need to make a few additional tweaks to the configuration of the newly created virtual machine. Right click on it and select Settings (CTRL+S) from the menu.

Select System→Processor and assign two CPUs.

2 processors are the minimum required for running the Hypervisor

Next, select the Network tab and configure Adapter 1. Select Host-only adapter and one of the vboxnet networks, most likely vboxnet0.Expand the Advanced section and select Intel PRO/1000 MT Server (82545EM) as the Adapter Type and Allow All for the Promiscuous Mode.

Don’t forget to configure the network card

Finally, mount the vSphere Hypervisor ISO in the Storage tab. Select the Empty optical drive and Choose the Virtual Optical Disk File by clicking on the CD icon on the right.

Mount the ESXi installation image

Select the VMware-VMvisor-Installer ISO you just downloaded, and it will replace the Empty disk in the Storage Tree.

Click OK to exit the Settings window and return to the VirtualBox main window. Start the VM. The installer will start and, after a few seconds, you will be presented with a screen having a grey and yellow background.

The ESXi loading screen

After all the modules load successfully, a black screen will appear asking you if you wish to continue.

Don’t stop me now

If you have no objections, accept the EULA by pressing F11. Select the ATA VBOX HARDDISK as the target installation disk and press Enter.

Select the local ATA VBOX HARDDISK as the target storage device

Choose an appropriate keyboard layout and set the root password for administrating the Hypervisor (and don’t forget it!). The installation program will perform a final system scan and probably log about Hardware Virtualization not being a feature of the CPU; you can ignore it.

Finally, confirm your intention to install the software by pressing F11 when prompted. If everything goes well, the installation program will report a success and ask you to remove the CD and reboot. You can do that by clicking on Devices→Optical Drives→Remove disk from optical drive.

Great success!!! We can now take off every Zig.

After rebooting the same set of loading screens we saw during the installation process will show up again. Eventually the Hypervisor services will be brought online and the system will be ready to accept commands.

The Hypervisor fully operational on VirtualBox

You’ll notice that the IP address displayed on the main screen is probably incorrect. What we need to do is assign a valid static IP on the Host-only network that we bound to the interface. We also need to assign the IP address of the host — the machine you are running VirtualBox on — as the Default Gateway. For example, if you’re host’s vboxnet interface is bound to the IPv4 address 192.168.33.1, set the Hypervisor’s IP address to 192.168.33.2 and the Default Gateway to 192.168.33.1. You can also manage this using a VirtualBox DCHP server, if you prefer.

Reconfigure the network interface by assigning a proper IPv4 address and gateway.

One more thing we need to do is configure the DNS servers. Press F2 to access the System Customization screen, and select Configure Management Network→DNS Configuration. Select the second option and enter the Google DNS server IP addresses: 8.8.8.8 as the Primary, and 4.4.4.4 as the Secondary. Leave localhost as the hostname, unless you really need to change it. The system will ask you to confirm your changes and proceed to restart the network.

Set the DNS server IP addresses

You might want to enable SSH access to the Hypervisor, by visiting the Troubleshooting Options screen.

Everything should be working well now. Try accessing the Hypervisor via HTTP on port 80, using your favourite web browser, as the main screen is suggesting. Ignore the security warning (sigh) and proceed.

Ignore the certificate warning

If you are using Windows, you can download the vSphere client and connect to the Hypervisor using its graphical interface.

In the next blog post, we’ll see how we can leverage Terraform and its declarative syntax to automate the provisioning of vSphere virtual machines, running Windows or Linux!