[TUT] Setting up your first VirtualBox VM
Hello everyone.
  • This write-up seeks to lightly cover VirtualBox and how to set up a VM using this software. During the demo, I'll be working with an ISO for Kali Linux.
  • The tutorial will begin at downloading the software, and will end on the first boot of the installation media.
  • The tutorial steps were recorded by Windows Problem Steps Recorder. It grabs every action, but saves the screenshots in a compressed format.
  • As installing the operating system you've built this VM for is an entirely separate process from configuring a VM, we won't be going into that with this tutorial.
  • Feel free to link to this thread as a reference material for helping users with getting started with virtualization.
  • For those interested in setting up a Kali Linux VM for the first time, I'll be completing a second tutorial shortly covering the actual installation once the VM has been built.
As a warning, this tutorial will be image-heavy, but they will be obscured by spoilers as to prevent your browser from getting bogged down.

About the Software

To quote the VirtualBox. org website, VirtualBox is a general-purpose full virtualizer for x86 hardware, targeted at server, desktop and embedded use.
It is also a type-2 hypervisor. To quote Wikipedia:

A hypervisor or virtual machine monitor (VMM) is a piece of computer software, firmware or hardware that creates and runs virtual machines.
A computer on which a hypervisor runs one or more virtual machines is called a host machine; and each virtual machine is called a guest machine.
The hypervisor presents the guest operating systems with a virtual operating platform and manages the execution of the guest operating systems.
Multiple instances of a variety of operating systems may share the virtualized hardware resources: for example, Linux, Windows, and OS X instances can all run on a single physical x86 machine.

While we won't be going into the differences in type-1 and type-2 hypervisors in this post, but its a nice piece of reference information.
Just to ensure all of our definitions are in place, a virtual machine according to Dictionary.com is a self-contained operating environment that behaves as if it is a separate computer.

Putting it all together

Bearing all of this in mind, VirtualBox is a software that you can install on your PC, your Mac, or your Linux box that allows you to emulate another set of physical hardware, and allows you to run another operating system in a closed environment. Your host machine is the actual machine you're using, while the guest is the VM you create. Think of it like a host sharing his food, electricity, and other resources with guests when they come to visit. In this tutorial, I'm going to cover the installation of VirtualBox step-by-step from a Windows machine. If you're on a Mac or a Linux machine the prompts will be very similar. When we're through, I'll have built a virtual machine that I can install another operating system to - Kali Linux as a guest of my Windows 10 host in this example.

There are several reasons one might wish to use a VM. You could wish to have an isolated environment for activities such as banking, conducting malware analysis, running a software unsupported by your operating system, trying out a new operating system at no risk to your system configuration, etc.

  • Windows, Mac, or Linux host operating system
  • Installation media for a guest operating system
  • Enough storage space to allow your VM to store its necessary files (varies by usage)
  • Enough RAM to allow your host and guest operating systems to run at once (varies by use)

Installation Walkthrough
  1. We're going to begin by downloading VirtualBox from the official downloads page, https://www.virtualbox.org/wiki/Downloads.
    Once here, we'll click on the VirtualBox platform package for our operating system. In this tutorial, that is VirtualBox 5.1 for Windows hosts x86/amd64.

  2. Once the installer has downloaded, launch it.
  3. You will be greeted by the welcome dialog.
    There's nothing for you to do here other than click Next.

  4. You will now be using the custom setup dialog.
    This dialog can be used to configure the features that VirtualBox installs alongside the core application. If you're new to VirtualBox then there's no need to tweak these settings. Just hit Next.

  5. You will still be using the custom setup dialog, but on a new panel.
    This dialog can be used to change your shortcut and file association settings. Modify to your preference, but beginners should at least leave Register file associations checked. Hit Next to continue.

  6. You will receive a warning regarding network interfaces.
    VirtualBox installs a network interface to your host machine to allow your VMs to connect to the internal/external network depending on their individual settings. Installing this adapter can pause your internet connection for a second, so hit Yes when you're not in the middle of a download.

  7. You will now be ready to Install VirtualBox.
    Now that VirtualBox knows your preferences, it's ready to add files to your machine and make the requested changes. Hit Install to get things going. Wait until installation is finished.

  8. You will be informed that installation is complete.
    Once VirtualBox has finished it's installation it will notify you in the instalaltion dialog and provide an option to start VirtualBox now. Leave the Start VirtualBox after installation box checked and click Finish.

  9. Is VirtualBox hiding?
    Sometimes when VirtualBox starts after installation it will not start as the top-most on your screen. Swap to VirtualBox in your taskbar.

  10. VirtualBox is installed.
    Congratulations, VirtualBox is now installed. Now, let's get ready to build our first VM.


New VM Walkthrough
  1. You are now ready to create your first VM.
    Now that VirtualBox is installed and running, click the New button to start the process of creating a new VM.

  2. You will be prompted to name the VM and choose the operating system.
    In order for VirtualBox to provide the best experience, it needs to know what type of OS you want to install. This choice affects it's hardware emulation. By default, VirtualBox assumes that a 64-bit installation of Windows 7 is the intended target. We'll adjust these settings in the next step.

  3. Modifying the VM type/version.
    The Name field allows text entry, while the type and version fields are pre-populated dropdowns. Since we're installing Kali Linux I'm using the generic name of Kali, the Type is Linux, and the Version is Other Linux (64-bit). VirtualBox has version options for popular Linux distros, but as Kali is not listed we should select Other. Sometimes VirtualBox will recognize the Kali ISO and select Linux 2.6/3.x/4.x (4-bit) as the version. Out of habit I still stick with using Other Linux (64-bit) - either should work without issue. Either way, in order to advance to the next stage we must click Next.

  4. You will be prompted to change the memory allocation.
    In order for your virtual machine to run, it needs to have resources allocated to it, and limits put in place. Allowing more RAM will allow the VM to perform at a higher capacity, but may slow the the performance of your host operating system. VirtualBox's Other Linux default is 512 MB of RAM. At the very least, 1 GB of RAM should be allocated (that's 1024 MB). Click Next to continue.

  5. You will be prompted to use a virtual hard disk.
    Your machine store's its files on your hard drive. Your VM will store it's files in a special file/container on your hard drive. Since this is your first VM, there will not be an existing virtual hard drive. Ensure that Create a virtual hard disk now is selected, then click Create.

  6. You will be prompted to select the hard disk type.
    VirtualBox can create virtual hard disks in a variety of formats to maximize the flexibility of the VM. This is great if you need to share a machine with someone who has VMware Player/Workstation Pro installed as you can use a .vmdk image. Since we're just building this VM for personal use, you should stick with VDI (VirtualBox Disk Image). Click Next to continue.

  7. You will be prompted to select the growth method of the critical hard disk.
    Since your VM can take up a decent amount of space on your hard drive, VirtualBox offers two options when using a VDI. You can have your physical hard drive dynamically allocate, wherein VirtualBox knows you're allocating up to 60GB of your drive to space to this machine but will only take 20 GB for the initial install and will take more space as required, or you can take a fixed disk size where VirtualBox creates a 60GB VDI for your operating system to match the space you've allocated to the machine. Unfortunately, dynamically allocated virtual disks cannot decrease in size, they can only increase. A fixed disk is always ready with no need to expand before performing an operation. As a result, you may get a better performance out of this disk type. Since my VMs are all on SSD's, I'm going to stick with Dynamically allocated - however, you may wish to do a fixed size. After making a selection click Next to continue.

  8. You will be prompted to select the file location and size.
    At this juncture, you now get to determine where your VM's virtual hard drive will be stored, and how large it should be. VirtualBox places VMs in the Default Machine Folder. The Default Machine Folder can be changed in the VirtualBox settings. By default, it is something to the effect of C:\Users\%USERNAME%\Documents\VirtualBox VM's. If you would like to change the location that the VM's virtual disk will be stored, click the folder icon to the right of the virtual hard-disk name as can be located using the image below. Since I've already modified my Default Machine Folder, I'm going to leave the virtual disk name the same as the machine name. I'm also going to give the VM more HDD space than the default suggestion. Personally, I never like to have a Linux VM with less than 15GB of space, and a Windows VM with less than 30GB of space. Once you've made your selections, click Create.

  9. You will now see the newly-created VM.
    After all that work, our VM has been created, but it is currently powered off. Let's select our VM, then hit Start to boot the VM.

  10. You will now be ready to start the VM.
    Click Start to power on your VM and boot from the virtual optical media (likely an ISO file) that you've selected.

  11. Your VM will boot.
    If you're booting a linux ISO, you'll see a prompt similar to the one below offering installation and live-boot options. You'll likely want to proceed with installation, unless you have a reason to only live-boot. If you're booting Windows installation media you'll be taken to the Windows setup screen so that you can install the operating system.

There you have it - a quick run-down on building your first VM in VirtualBox.
All that's left is to proceed with the installation and your VM will be up and running. While I wrote this to able to cross-reference in some future posts I hope that any beginners who come across this will find it to be a useful reference in itself.
Good informative post with a constructive layout - great tutorial.
I will be referring to this if I set it up again, cheers!
This Is definitely of benefit to those new to the Installation and setup of VMs.

Personally, I cannot do without one. I'm running a network of VMs, namely Hyper-V which Is defaulted to the Windows platform (supported editions). They all communicate and are dedicated to their tasks of which they're configured to perform.

Good work Albus.

Forum Jump:

Users browsing this thread: 1 Guest(s)