This tutorial provides a simple to follow roadmap to understanding, installing and using a virtual machine (VM).
The tutorial shows you how to install a VirtualBox VM environment on a Windows 10 computer with a Ubuntu Linux guest system.
The instructions are generally the same when installing on a computer running MacOS or Linux.
Obtain approval from your supervisor and or IT department, as appropriate in your jurisdiction, to install a VM on your computer.
A virtual machine application (sometimes also called a hypervisor or a virtual machine monitor) installed on a computer allows you to effectively run, or emulate, a separate computer inside an application window on that computer. The environment within which a VM is launched is usually called a host. Individual VM instances launched from the host are referred to as guests.
A VM guest instance behaves like a separate computer, including the simulation of hardware devices such as memory, video outputs and hard drives, for that computer. It is possible to maintain any of a number of different operating systems within a VM environment. The only limitation is the amount of hard drive space available. Having said that, you likely should not run a whole bunch of guest instances at the same time, given the significant resource demand for even running a single instance.
There are two types of virtual machine host environments:
This tutorial deals with a system VM, specifically the VirtualBox VM hosting environment.
Note that a guest VM will not run as fast as the host computer due to the simulation processing overhead. As we will see, it is possible to improve this performance by "borrowing" additional resources from the host computer for use by a particular VM guest instance.
Here is a screenshot of a VM application installed on a MacOS host, running a Windows 10 guest session:
Virtual machine host environments are available for Windows, MacOS and Linux based computers.
A VM offers some handy benefits, the most useful of which is "sandboxing". A guest operating system running in a VM has no access to the underlying host computer. The host computer is thus protected from any malicious software which may execute in the VM. It is therefore a great way to test software and/or online sites and resources, without fear of hurting your host computer. A VM can also help limit the risk of running a Tor browser by encapsulating such a session within the sandboxed environment.
A VM is also a great way to experiment with different operating systems, try out new applications, or run old operating systems and applications.
VM's are often used to explore how malware behaves in order to build better tools to fight these threats.
There are several options for running a VM hosting environment on your computer:
MacOS users also have another option:
Linux users can also create and run VM's with the virt-manager utility, available in most distros.
This tutorial will use the VirtualBox environment. We will install it on a Windows 10 host and then install and run a Ubuntu guest VM.
Download the VirtualBox installer from the VirtualBox site (click on the Windows hosts link):
Also download the VirtualBox Oracle VM VirtualBox Extension Pack. The link is just below the platform packages links.
The Extension Pack enables use of USB devices by the VM's, among other additional features.
You should now have two files in your Downloads folder. Double click the VirtualBox installer file to start the installation.
Follow the prompts. Accepting the default settings is fine. The installer will run and once VirtualBox has been successfully installed, you will see this prompt:
Check the box to start VirtualBox and click Finish. VirtualBox should start and you should see the following screen:
At this point we can install new guests.
We will install a Ubuntu Linux VM. To start, download an installation ISO from the Ubuntu website at https://ubuntu.com/download/desktop.
This is a large file (over 2 GB), so if you have a slow connection, this may take a while. You may want to get a coffee or get your steps in for the day.
Once downloaded, the ISO file should appear in your Downloads folder (or such other location as you may have chosen when downloading or set as a default download folder). Take note of the folder name and location.
Go back to the VirtualBox application, and click the blue New button to add a new guest OS VM:
A dialog box will appear. Give the new VM a name and select the Type and Version. Then click Next:
You will be prompted, in a number of dialog boxes, to confirm the VM memory size (accept default of 1024 MB), hard disk type (select VDI if not already selected), create a new virtual disk of 10 GB size (accept if there is enough room on your PC. If not it is OK to reduce this to 5 GB). Once you confirm all that, it should bring you back to the VirtualBox main window and a new VM should now appear in the left column (highlighted in blue below):
With the new VM highlighted, click the green Start arrow at the top of the right column. This will start the VM. Given that no operating system has yet been installed, it will prompt you for a start up disk:
Click the little yellow folder on the right. This will pop up another dialog box, where you should click the the blue "Add" button. Select the Ubuntu ISO file, and then click the Choose button:
After you start your VM, you may also see the following dialog box, which explains how your mouse controls the VM. Take note that you can bring the mouse back outside the VM window, by hitting Right Ctrl on your keyboard:
Once you have selected the Ubuntu ISO, the installation process will start. The first step is to select your language of choice. Move your mouse into the VM and select it. Then hit enter.
You will next be presented with the Ubuntu install options screen. Select Install Ubuntu and follow the prompts to complete the installation:
Once the installation completes, you will likely be asked to reboot. After that you can simply start the VM by selecting it from the list and clicking the green Start arrow:
Once a guest VM has been installed, you will want to install the Guest Additions Add-on in order to optimize the running of the VM on the particular host system. Note that this is a different configuration than adding an Extension Pack (for that see the optional Step 4).
The Guest Additions package ensures that the mouse pointer works properly and also enables folder sharing, time synchronization and clipboard functionality in the VM.
A full description of the additional functionality available is here.
To enable Guest Additions, do the following:
If your VM requires any of the following functionality, you should install the extension pack:
VirtualBox extension packages have a .vbox-extpack file name extension and they are downloadable from the main VirtualBox download site (see above).
To install an extension, just double-click the downloaded file and follow the steps.
If a VM is running slow, there are some adjustments you can make to help improve performance.
First, close any applications or processes running on the host computer which are not currently required.
Second, tweak the resource settings for the VM. Go to the Machine entry in the VM guest instance menu. This will reveal a menu where you can make a number of changes:
Usually increasing the base memory will boost performance the most (note that this may in turn slow down your host machine if it does not have sufficient memory to manage its own running processes).
Instead of installing an operating system from scratch, it is also possible to directly load a VM image. There are a number of sites where these images can be downloaded (see the Resources section below).
After downloading a VDI file, place it in your VM directory and then follow the following steps to install it:
(Be sure to have the login credentials for the VDI handy. These are usually provided with the download link for VDI images. Again, see the Resources section below.)
Cloning a VM creates a backup of the VM, which you can then launch as a separate VM altogether.
Snapshots freeze the state of a VM at a particular point in time.
Snapshots save the exact state of a VM, so you can start from that point onward, the next time the VM is launched. A snapshot is also taken when you select the "Save the machine state" option when closing a VM.
The "Power off the machine" option will restore the VM to the last saved snapshot.
You can also take a snapshot while a VM is running.
Access these options under the Machine item in the VirtualBox menu or from the menu icon to the right of the name for a VM in the list (the Clone option will then appear at the top right as a cute little sheep).
If you have a VM nicely configured for your purposes and you want to share it with others or maybe run it on a different platform, you can export it as an OVF file.
The process is quite simple: Select the blue "Export" arrow from the VirtualBox main page, select the VM you want to export and follow the steps!
To import an OVF (or OVA - another similar format) file, click the "Import" arrow and follow the prompts.
Many Linux distro images. Note these credentials for logging into a guest instance: Username (including root): osboxes, Password: osboxes.org
Many Linux distros and a few other images. User credentials are set out next to each link.
Many older Windows operating system images.
This is a 5GB file. Image expires after 90 days. Password is "Passw0rd!"
This is very large file: 20 GB! Variable expiry date - see website.
Whonix OVA file download.
VirtualBox Subreddit: https://www.reddit.com/r/virtualbox/
Running Tails in VirtualBox: https://tails.boum.org/doc/advanced_topics/virtualization/virtualbox/index.en.html