Deploy a Virtual Machine With Oracle’s Open Source VirtualBox

I depend on virtual machines on a daily basis. Not only do they allow me to review Linux distributions with ease, but they also make it easy for me to deploy servers that can be easily accessed from within my LAN.
For nearly two decades, I’ve used VirtualBox as my virtual machine technology of choice. The reason I opted to go the Oracle open source VirtualBox route is that I find it easier to use than other options, but it’s readily available on most standard Linux repositories. Of course, if your OS of choice is macOS or Windows, there’s a version of VirtualBox for you as well and that also helps to make this an ideal platform for deploying virtual machines.
On top of those reasons, you can start a VirtualBox virtual machine from either the well-designed GUI or the command line, which means I can start and manage a virtual machine by logging in via SSH and running the necessary CLI tools.
What I want to do today is walk you through the process of deploying your first virtual machine with VirtualBox. I’ll demonstrate this using the latest release of Ubuntu Desktop.
What You’ll Need
To deploy your first virtual machine, you’ll need the following:
- VirtualBox is installed on your host platform of choice. You can download an installer for the latest release from the official VirtualBox.org site.
- An ISO for the guest OS you want to install. For this tutorial, download the Ubuntu Desktop ISO from the official download page.
That’s it. Let’s get to work.
Create the Virtual Machine
The first thing to do is create your virtual machine. Once you have VirtualBox installed, fire it up and click “New” from the main window (Figure 1).
-
Figure 1: I have several virtual machines already created and ready to use.
On the first page of the VM wizard (Figure 1), give the virtual machine a name (such as Ubuntu Desktop). You’ll also want to make sure the folder selected has enough space to fit the virtual machine.
Next, click the ISO Image drop-down menu and select “Other.” When your file manager opens, navigate to where you saved the Ubuntu Desktop ISO image, select it, and click “Open.”
I suggest clicking the check box for “Skip Unattended Installation”; otherwise, you won’t be able to set a username and password for your installation. When you select the Ubuntu Desktop ISO, it should automatically fill out the Type and Version drop-downs for you.
-
Figure 2: When you add the ISO image, the Type and Version should automatically fill out.
Click “Next” to continue.
In the next window (Figure 3), set the Base Memory and Processors options. Make sure to give the virtual machine enough resources to power the OS and any services it might run. Click “Next” to continue.
-
Figure 3: I typically give virtual machines 3072 MB of base memory and 2 CPUs, unless I know the VM will require more.
Next, you’ll need to set the size of the virtual hard drive (Figure 4). One thing to keep in mind is that, by default, the virtual drive will not automatically take up 100% of the space you define.
What happens is that, as the OS grows (because of installed applications and saved data), the size of the virtual drive will expand until it reaches the maximum amount you’ve set. For testing purposes, I’ll allocate anywhere between 80 to 100 GB for a virtual hard disk.
-
Figure 4: You can opt to preallocate the full disk space, but I wouldn’t recommend doing so.
In the final screen of the wizard (Figure 5), you can view the summary of your new virtual machine. If everything checks out, click “Finish.”
-
Figure 5: The summary of our new virtual machine.
Customize the Settings
If you want, you could immediately select the new virtual machine and click “Start” to launch the Ubuntu Desktop installation process. However, before you do, I highly recommend you open the Settings window for the VM, click on the Network tab, and select Bridged Adapter from the “Attached to” drop-down menu.
Why? Simple: If you use the default NAT option, you won’t be able to access the virtual machine from your LAN. If you want to be able to reach the VM, select Bridged Adapter (Figure 6) to ensure the virtual machine is given an accessible IP address.
-
Figure 6: If you don’t change the networking setting, you won’t be able to access your virtual machine.
Once you’ve taken care of that, click “Start” to launch the installation process for the new virtual machine. The installation will be the same as if you were installing the operating system on bare metal (Figure 7).
-
Figure 7: The Ubuntu Desktop installation process will look the same as if you were installing it on a dedicated machine.
You could also change the Graphics Controller (in the Display tab) from the default to VBoxSVGA, but that will depend on your host operating system. I tend to go with VBoxSVGA on Linux guests because it makes it easier to resize the main window to accommodate the desktop.
When the installation completes, you’ll be prompted to reboot and remove the installer media. With some Linux distributions (such as Ubuntu), the installer media is deleted automatically so all you have to do is hit “Enter” on your keyboard when prompted and allow the boot process to finish. Log in and enjoy your new virtual machine.
Congratulations on deploying your first virtual machine with VirtualBox!