Install Ubuntu Server 14.04+ on VirtualBox


This guide will explain how to install Ubuntu Server 14.04 on a VirtualBox virtual machine in a detailed step-by-step manner, with screenshots. It is intended as a companion guide to my post on setting up a Drupal development machine on Windows with Ubuntu Server in a virtual machine. I broke it apart mainly due to length and clarity.

Download VirtualBox and install it. VirtualBox is simple to install and you would install them just like any other Windows program. Download Ubuntu Server and keep the ISO file handy. Follow the screenshots below. The screenshots below, and the title of this blog post says Ubuntu Server 14.04, but it should be mostly similar for later versions as well.

Start VirtualBox. You should be greeted with an interface like above. You might not have any virtual machines listed on the left side.

02-vbox-new-vm

Click on New to start creating your new virtual machine. Give a name like Ubuntu Server and select Type as Linux and Version as Ubuntu (64 bit). Click Next.

03-vbox-mem

Select the amount of RAM. I selected 1.5 GB RAM but yours may vary depending on your needs and your machine. I would recommend at least 768 MB.

04-vbox-hdd-size

It’s time to set the hard disk size. Around 16 GB is enough as this is just for the OS and tools. I typically create new virtual disks for the web files and database.

Start VM

Your virtual machine is done. Select the machine in the list and click Start.

06-select-iso

On first start, VirtualBox will ask you to mount an image for installation media. Click on the Browse icon on the right side to select the Ubuntu Server ISO file you downloaded.

07-language

Ubuntu Server Installation first asks for the language. Pick your language. The rest of the screenshots are using English.

08-ubuntu-menu

You come to the familiar Ubuntu Server installation screen. Select Install Ubuntu to continue the installation.

09-country

Select your country. I picked India.

10-keyboard-layout

And keyboard layout. In most cases, you will pick English (US).

11-progress

It will load additional components. Wait for it to complete.

12-hostname

This is an important step. Type in the hostname with which you would access this machine later. I have typed in hwvmsrv, with vm indicating that this is a virtual machine on the network.

13-realname

Type in your real name.

14-username

And your username. This is what you will use to login to your virtual machine. I keep it very short, such as just hw.

15-password

Finally, type in the password you want.

16-partition

Ubuntu can guide you in setting up the partitions as you want. However, since this is a virtual machine, you typically want to use entire disk and have it setup LVM.

17-progress

It will actually install the system now. Wait for it to complete.

18-apt

It will also configure the package manager. Before this, you will get a chance to configure proxy settings for your network. If you are not using a proxy, you can skip those steps.

19-updates

Configure updates as per your preference. I prefer installing updates manually.

20-grub

You should say Yes to this prompt, unless you know what you are doing.

21-finish

You are done. Ubuntu is now installed on your virtual machine. Eject the ISO and select Continue to restart the virtual machine.

22-login

After restarting, you will get a prompt to login. Use your username and password to login.

23-apt-get-upgrade

Run sudo apt-get upgrade to make sure you get all the upgrades. Usually, there won’t be a lot unless the ISO is quite old.

24-vbox-settings-processor

The machine is ready and installed now. But let’s configure the virtual machine. I typically set an execution cap to 80% to make sure the virtual machine does not overload the host machine.

25-vbox-settings-network

Add a second adapter to the virtual machine by right clicking the virtual machine, and selecting Settings. In the settings window, select Network and go to Adapter 2 tab as shown in the screenshot. Select Host-only adapter and other settings as shown in the screenshot (most are defaults).

26-vbox-hard-disk27-vbox-storage

We’ll store our website files and database on a new virtual disk. In the settings window, go to Storage and right click on SATA controller. Select Add Hard disk from the menu. Click on Create new disk from the popup window. Follow the instructions to create a new disk. I typically select a dynamic disk of 100 GB.

27-vbox-networking

You can optionally setup more networking parameters. You can set the host machine IP and all virtual machines will fall in the same subnet. You can access this dialog from VirtualBox main window and selecting Preferences under File menu and then selecting Network in left side.

28-eth1

Add eth1 in /etc/network/interfaces for Host only adapter (Ubuntu Server doesn’t add it). This is necessary to configure the second adapter we added to the virtual machine. You can look up examples by a simple Google search, such as this one.

This builds a simple machine ready for use. We will configure it further for Drupal development in another post.