How to Install Ubuntu Server 14.04.1 on ESXi 5.5

In this post, I’ll walk through building an Ubuntu Server virtual machine on an ESXi 5.5U1 host using the latest 14.04.1 LTS version. The Ubuntu Server will be built without any of the predefined software collections and VMware Tools will be installed. As a bonus the virtual machine will be cloned to a Template so that it can be used to build additional Ubuntu VMs for testing various scenarios and projects. I assume you’re already familiar with Linux and VMware vCenter.

Prerequisites

  • vCenter Server installed on the ESXi host.
  • Ubuntu Server 14.04.1 LTS 64-bit ISO uploaded to your ESXi datastore.

Install Ubuntu Server

  1. Launch a Web browser and login to the vSphere Web Client.
  2. From the vCenter Home page click on "Hosts and Clusters."
  3. Select the "Getting Started" tab and click "Create a new virtual machine."
  4. When the New Virtual Machine dialog appears select "Create a new virtual machine" and click the "Next" button.
  5. Enter a name for the virtual machine and select a datacenter or VM folder in which to store it. I named mine "Ubuntu 14.04.1 LTS Server 64-bit." Click "Next."
  6. Select a host to run the virtual machine and click "Next."
  7. Select a datastore for the VM configuration files and virtual disks.
  8. Select the virtual machine version to use. Note that if you select "ESXi 5.5 or later" you will not be able to use the legacy vCenter Windows client to modify VM configuration. Click "Next."
  9. Change the "Guest OS Family" to "Linux" and the "Guest OS Version" to "Ubuntu Linux (64-bit)." Click "Next."
  10. On the "Virtual Hardware" tab, expand "CPU," and select "Expose hardware assisted virtualization to guest OS."
  11. Set the "CPU" value to 2.
  12. Set the "Memory" value to 2048.
  13. Expand "New Hard disk," set the size to 60 GB, and set "Disk Provisioning" to "Thin provision."
  14. Set the "New Network" value appropriately. In my case that was "Management (DSwitch)."
  15. Set "New CD/DVD Drive" to "Datastore ISO file" and select the ubuntu-14.04.1-server-amd64.iso stored in your datastore. Click "OK."
  16. Place a checkmark next to "Connect" for "New CD/DVD Drive."
  17. Click "Next."
  18. Review the summary screen to ensure all the values are correct. Click "Finish."
  19. Right-click your newly created VM and select "Power On."
  20. Right-click the VM again and select "Open Console."
  21. The Ubuntu installation process should begin automatically and the first prompt is to choose a language. Select English and press enter.
  22. Highlight "Install Ubuntu Server" and press enter.
  23. Select "English" as the language for the installation process and installed system and press enter.
  24. Select your location. In my case I chose United States. Press enter.
  25. On the "Configure the keyboard" screen select "Yes" and press enter.
  26. After completing the keyboard configuration process select "Continue" and press enter.
  27. Enter a hostname for the VM. I entered "ubuntu-temp" since this VM will be templatized to clone additional systems that will be renamed.
  28. Ubuntu prompts you to create a user account to be used instead of a root account. Start by entering the full name (first and last) of the user and Press enter.
  29. Enter a username for the account and press enter.
  30. Enter a complex password and press enter.
  31. Re-enter your password and press enter.
  32. I chose not to encrypt my home directory, so select "No" and press enter.
  33. Select your time zone and press enter.
  34. Select "Guided - use entire disk and set up LVM" and press enter.
  35. Since there is only 1 disk at the moment press enter to partition the disk.
  36. Select "Yes" and press enter to write the changes to disk and configure LVM.
  37. Accept the default amount of the volume group that will be used for guided partitioning. This tells the installer to use the full disk and press enter.
  38. Select Yes and press enter to write the changes to disk.
  39. The install will begin and at some point it will prompt you to enter your Internet proxy. I don't use one, so I left it blank and pressed enter.
  40. A dialog will be presented asking you how you want to manage system upgrades. In this case I'll manually apply updates, so I selected "No automatic updates" and pressed enter.
  41. Since this install will only contain the core Ubuntu Server packages and will be used as a VM template for future builds I didn't select any collections and pressed enter.
  42. We will configure the GRUB boot loader manually so choose "No" when prompted to install GRUB to the master boot record.
  43. You will be prompted to specify the device for the boot loader installation. Since the VM is using SCSI drives and there is only one enter "/dev/sda" and press enter.
  44. The installation should be complete at this stage. Press enter to restart the VM and boot into Ubuntu.
  45. You should be able to login with the credentials created during steps 29-31.

Install OpenSSH Server

Since we did not select any of the standard software collections SSH is not available in our Ubuntu server. This can be easily remedied by installing an OpenSSH server, an open source version developed by the OpenBSD Project.

  1. Launch a Web browser and login to the vSphere Web Client.
  2. From the vCenter Home page click on “VMs and Templates.”
  3. Right-click the VM again and select “Open Console.”
  4. Login with the credentials used during the server installation process.
  5. Install OpenSSH Server by running the command below:
    $ sudo apt-get install openssh-server
  6. Enter your password to gain sudo privileges.
  7. You will be prompted to confirm the installation so enter “Y” and press enter.
  8. The download and installation should complete within a few seconds.
  9. I like to make a copy of the default OpenSSH Server configuration just in case I ever need to compare my modifications to a known-good copy. Execute the commands below to make a read-only copy in /etc/ssh:
    $ sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.factory-defaults $ sudo chmod a-w /etc/ssh/sshd_config.factory-defaults
  10. Ubuntu’s default configuration tries to strike a balance between security and ease-of-use. To read more about changes you can make to increase security refer to the Ubuntu OpenSSH documentation.
  11. You should now be able to SSH to your Ubuntu VM and login with the credentials created earlier.

Install VMware Tools

VMware Tools is a group of utilities and drivers that enhance the performance of the virtual machine’s guest operating system when running on an ESXi host. The steps below walk you through installing VMware Tools on our Ubuntu Server 14.04.1 LTS virtual machine using the command line. Note that whenever you update the Linux kernel you will have to reinstall VMware Tools.

  1. Launch a Web browser and login to the vSphere Web Client.
  2. From the vCenter Home page click on “VMs and Templates.”
  3. Right-click the VM and navigate to “All vCenter Actions” > “Guest OS” > “Install VMware Tools.”
  4. When prompted click “Mount” to mount the VMware Tools installation disk image on the virtual CD/DVD drive of the Ubuntu Server virtual machine.
  5. Right-click the VM again and select “Open Console.”
  6. Login with the credentials used during the server installation process.
  7. Mount the VMware Tools CD image to /media/cdrom:
    $ sudo mount /dev/cdrom /media/cdrom mount: block device /dev/sr0 is write-protected, mounting read-only
  8. Extract the VMware Tools installer archive file to /tmp:
    $ tar xzvf /media/cdrom/VMwareTools-*.tar.gz -C /tmp/
  9. Install VMware Tools by running the command below. Note that the -d switch assumes that you want to accept the defaults. If you don’t use -d switch you can opt to choose the default or a custom setting for each question.
    $ cd /tmp/vmware-tools-distrib/ $ sudo ./vmware-install.pl -d ... The configuration of VMware Tools 9.4.5 build-1598834 for Linux for this running kernel completed successfully. ...
  10. Reboot the virtual machine after the installation completes:
    $ sudo reboot

Clone the VM to a VM Template

As mentioned earlier the intent is to use this base Ubuntu Server VM as a template for creating as many servers as I need for testing out new tools and scenarios. To eliminate the build process each time I need to spin up another server I’ll save this VM as a template using the steps below.

  1. Launch a Web browser and login to the vSphere Web Client.
  2. From the vCenter Home page click on “VMs and Templates.”
  3. Right-click the VM and select “Open Console.”
  4. Login with the credentials used during the server installation process.
  5. Shutdown the virtual machine:
    $ sudo shudown -h now
  6. Close out the Console and go back to the vSphere Web Client.
  7. Right-click the VM and select “Shut Down Guest OS.”
  8. Right-click the VM and select “Clone to Template.”
  9. The first step is to enter a name for the template. I chose “Ubuntu 14.04.1 LTS Server 64-bit” and clicked “Next.”
  10. Select an ESXi host or cluster to store the template in and click “Next.”
  11. Just to be sure set the virtual disk format to “Thin Provision.” Select a datastore for the template files and click “Next.”
  12. Review the summary screen describing the selections you made and once satisfied click “Finish.”
  13. Depending on the ESXi host’s available resources the cloning process make take 1 or more minutes to complete.

Test Creating VM from VM Template

Before I end this post I would recommend that you test creating a virtual machine from the template to ensure that you can rely on it in the future.

  1. Launch a Web browser and login to the vSphere Web Client.
  2. From the vCenter Home page click on “VMs and Templates.”
  3. Right-click on the “Ubuntu 14.04.1 LTS Server 64-bit” VM template and select “Deploy VM from this Template.”
  4. Enter a name and select a location for the new virtual machine and click “Next.”
  5. Select an ESXi host or cluster to run the VM and click “Next.”
  6. Select a datastore for the VM and its configuration files and click “Next.”
  7. Enable “Power on this virtual machine after creation” and click “Next.”
  8. Review the summary screen describing the selections you made and once satisfied click “Finish.”
  9. Depending on the ESXi host’s available resources the build process make take 1 or more minutes to complete.
  10. Right-click the VM and select “Open Console.”
  11. Login with the credentials used during the server installation process.

Summary

The goal of this post was to walk through the process of building an Ubuntu Server virtual machine using the most recent LTS version in an ESXi environment, setup SSH for remote administration, install VMware Tools to increase performance, and clone the VM to a Template so that identical copies of the Server can be built quickly in the future.

In upcoming posts I’ll refer back to this VM Template as a base image upon which each system will be built.