Assuming you followed the previous article, on deploying ESXi 4.0, without any major problems you should now have your first ESXi4 host server up and running. You will be pleased to hear that you have already done all the text console configuration that is required and from now onwards everything will be done using the vSphere 4.0 Client and its graphical interface. The vSphere 4.0 Client will only run on systems with Windows XP Pro SP2 or later versions of Windows so you will need a suitable system with a network connection to your ESXi 4.0 host server.
Getting Started with the vSphere Client
You may have downloaded the vSphere Client installer when you downloaded the ESXi ISO from the VMware website, in which case run that to install the vSphere Client on your system. Otherwise open Internet Explorer and enter the IP address of your ESXi server in the address bar, then click the link on the page which opens to download and install the client. Considering the small size of the installer package it can take a surprising amount of time to extract the files and install so be prepared to be patient. Once it has completed you will find a new shortcut on your desktop and in your Programs list for the “vSphere Client”, so double-click it and you will be presented with a logon prompt:
Enter the IP address of your ESXi host, the username “root” and the password you selected when you did the initial configuration, then click “Login”. Provided you got the details corrected the client will logon to the ESXi host and display the intial welcome screen, for those of you familiar with the previous “VI Client” this will be rather different to what you expect, but click the “Inventory” icon and you will see something much more recognisable:
As you can see the left pane lists the ESXi host you are managing, you can add as many hosts as you like in here and easily switch between them with one click. Select the “Summary” tab on the righthand pane and you will see an overview of your server’s hardware and other vSphere related information.
Creating a Datastore
The first thing you need to do is setup some storage for your Virtual Machines, which vSphere refers to as a “datastore”. VMware have their own proprietary file system called VMFS, which is specifically designed and optimized for virtualization – key features include advanced snapshot support and concurrent host access allowing multiple ESXi hosts to share a datastore. No need to worry about that at the moment, just select the “Configuration” tab and then click the “Create New Datastore” link to start the “Add Storage” wizard:
Leave the default “Disk/LUN” option selected and then if you have more than one disk in your server select which one you wish to use. Assuming you only have one disk, or have selected the boot disk you installed ESXi on, you will see there are already a number of partitions taking up about 1GB of space. This is the ESXi installation so you don’t want to overwrite it! Select the “Use Free Space” option and click “Next”.
Enter a suitable name for your datastore then click Next, on the next screen you have to choose the block size for your VM.
Note that the block size you choose limits the maximum file size for the datastore, which effectively means the maximum size of virtual disk you can create. Anecdotal evidence suggests there is a slight performance hit with larger block sizes, certainly disk space utilization is less efficient so unless you know you will definitely need to mount larger disks (say if you are intending to convert a physical server with a large data disk volume) choose the smallest block size. Click “Next”, check your settings one more time, and then complete the wizard to create your datastore. In the bottom pane of the vSphere Client window you will see the “Create Datastore” task appear and its progress indicator increase until completion, then the datastore will appear in the host summary.
By default when it is first installed ESX only configures the first available NIC as both the management interface and vSwitch0 for use by virtual machines. Assuming your host server has more than one NIC installed you can either add these to vSwitch0 for redundancy and load balancing, or create additional vSwitches. On each vSwitch you may also create multiple VMnetworks, with different vLAN Ids if necessary, which can be mapped to your virtual machines. Depending on your requirements you may prefer to create seperate vSwitches for each NIC, for physical separation of networks, or use VMnetworks and vLANing for virtual separation. If you do not have experience of vLANs and need to ensure some of your VMs are separated from others on the same host, e.g. in a DMZ/LAN setup, then I suggest you stick to multiple vSwitches and cable your NICs appropriately.
For the time being the default setup is all you need to get your first VM up and running so just leave it on the default settings for now:
Creating Your First Virtual Machine
Click the Summary tab to return to the overview of your host server and you will now see the new datastore and the default “VM Network” listed in the Resources section:
Now you are ready to begin setup of your first VM so click “New Virtual Machine” in the Commands section to start the wizard.
For the purposes of this demonstration we will assume you are deploying a Windows 7 system so you can do some testing, so select the “Typical” option. There is rarely any need to select the “Custom” option unless you have specific requirements, in particular the need to retain compatibility with older versions of ESX. On the next page enter a suitable name for your new VM and click Next, then on the next page your datastore should already be selected as the only one available so click Next again. Now you should choose the OS version you are intending to install, choose the type from the list and then the specific version from the dropdown menu.
All the major current OS distributions should be listed in their respective categories, and the major older alternatives are also under the “Other” option, however should you have something which isn’t listed then select Other – Other (32bit) or Other(64bit) as appropriate. The main effect your choice here has is in defining the virtual hardware that the ESX host emulates for the OS, e.g. for older OS’ it will emulate a basic 10/100Mb NE2000 compatible network adaptor, whereas for the more modern ones a 1Gb AMD NIC will be emulated. You can change these options later but it involves editing config files by hand so it is a good idea to choose a supported OS for your first VM.
Click next and you now have to select the settings for the system drive for your new VM (you can add more disks later):
Define an appropriate size for your disk, here the same principles apply as if you were setting up logical drives on a physical server so you probably want to keep it fairly small and allocate a large volume for data later on. The “thin provisioning” option is a newish (it was in VMware Server but not ESX3) addition which allows for more efficient use of disk space – your VM OS sees the disk as the size you define, but it only takes up the space it is actually using on the datastore. There is a small performance hit, and the risk of halting VMs if all the free space in the datastore is used up, so you may wish to avoid it for production VMs, however it can be useful for development and non-critical VMs. There is no harm in selecting the “Support Clustering features ….” option although bear in mind that Fault Tolerance is only available in the Advanced and Enterprise versions of vSphere so you may never get to use it, also Thin Provisioning is not available if you select it.
The final section of the wizard summarizes your selections and clicking “Finish” now will create your VM, however you can check the “Edit the VM settings…” box if you want to examine other settings such as memory allocation:
Most of the options are self-explanatory, you can allocate more memory and CPUs as you require (you can over-allocate host machine resources but try to avoid that for now), and you may want to remove the Floppy device if you are unlikely to use it. VMware do not recommend specifying more than one CPU for a VM unless you know that the application it will be running has been particularly optimized for multiple CPUs, the way that the hypervisor works means more virtual CPUs can actually reduce performance. All the settings can be changed at any point in the VM’s lifetime although most changes will only take effect after a reboot of the VM. Ignore the Options and Resources tabs for the time being as they deal with advanced settings which are beyond the scope of this article. Once you are done editing click Finish and your VM will be created – you will see the task appear in the bottom pane of the vSphere Client and when it is complete the VM will be listed in the lefthand pane.
Installing the OS
Note that your VM doesn’t really exist yet, you can click to select it and see all the settings in the Summary pane, however if you Start it not much will happen as you haven’t installed the OS yet. Comparing your new VM to a physical server setup you are now at the point where you have assembled all the components of your server and created your RAID array ready to start the OS installation. To do this you would insert CD 1 of the installation media into the drive and start the server, which would then boot off the CD and start the install. The process with your new VM is pretty similar, it has a virtual CD/DVD drive mapped so you just need to provide the media for it to boot off. Here you have several choices, the easiest being if you have an ISO image of your CD (if you just have the physical CD there are several utilities that will create an ISO for you available on the web). By default vSphere maps the virtual CDROM in “Client Device” mode, which allows you to connect a CD or ISO from the vSphere client computer, however getting the VM to boot from this is tricky. Instead the best option is to first copy the ISO image to the ESX datastore, to do this return to the Summary tab, right-click on the datastore name and select “Browse Datastore”. This will open a new window with a basic file explorer showing the datastore contents, at present you should just see a folder named for your Virtual Machine. Click the appropriate icon to create a new folder called “ISOs” then open that folder and click the “Upload files” button to copy your ISOs to the datastore:
When it has completed uploading close the browser and return to the VM Summary page, then under the “Commands” section click “Edit Settings” (make sure your VM is shutdown). Select the CD/DVD drive in the hardware list and under “Device Type” on the right change it to “Datastore ISO File” and Browse to the ISO you just uploaded. Make sure the “Connected” and “Connect at Power ON” options are both checked then click OK to close the window and you will see another task run to update the VM settings.
Now to start your VM click on the “Console” tab and then click the green “Start” icon on the toolbar above to turn the virtual power on. Your VM should see your ISO as a CD in its drive and boot off it into the OS installation routine, then you can follow the standard setup procedure. Click anywhere in the console screen to activate control, to release control back to your desktop press Ctrl-Alt. To “eject” the CD when you no longer need it you can return to the VM Settings page and uncheck the “Connected” and “Connect at Power On” boxes.
One problem that may occur is your VM will not attempt to boot off the CD – if this occurs you may need to change the Boot sequence in the VM BIOS (just like you would on a physical server). It can be tricky to press the F2 key in time before the POST screen disappears so instead you can force it to open the BIOS on the next boot. To do this go back to the VM Settings window and select the “Options” tab, down under the Advanced section click “Boot Options” then on the right you will see a check box for “Force BIOS setup”. Check that and then next time you boot your VM you will find yourself in the BIOS settings screen, use the cursor keys to change to the “Boot” menu and move the CDROM to the top of the boot order.
You should now find yourself with a fully working VM, and using the vSphere Client Console you can do anything just as if you were sitting in front of a physical system. More than that you should find its network interface is connected to your LAN, so if you have a DHCP server it will have been assigned an IP address on your subnet, and if you wish you can just change it to a static IP. With desktop OS’s like Windows 7 in the example above you will probably find the vSphere Console a bit restrictive, so it’s easier to enable Remote Desktop access. You can do this by going to the “System” settings in the Control Panel, and then select the “Remote” tab and follow the prompts to enable RDP for the users you define.
You can add as many VMs to your host server as you like, the only limiting factor is the disk storage available, and the total system resources will limit the number of VMs you can practically run. Often the most serious bottleneck is in fact the storage system, which can alleviated by adding more disks or multiple arrays, or even better deploying a Storage Area Network.
It may take you a little time to fully understand the principles of virtualization, and how the VMs can co-exist on the same physical server whilst remaining effectively separate, but after some practice it will become clear. There are a large number of prebuilt “virtual appliances” available on the VMware website here that you can download and import straight onto your ESXi host, I recommend trying a couple of these to help you get to grips with the potential of virtualization.