Skip to content

Set up a virtual machine

Kyle Terrien edited this page Jul 3, 2017 · 3 revisions

A virtual machine (VM) is a software-based implementation of a computer's hardware. A common use case for virtual machines is to run one operating system (the guest) within another one (the host).

Pros

  • Easier to set up, compared with dual-booting
  • You can use Linux and your host OS simultaneously (alternatively, you can use a Linux host and run Windows in a VM)
  • VMs run in a sandbox, so it's difficult for malware in the guest to infect the host or other guests
  • Most VMs use dynamically-allocated storage, which consumes less disk space compared to native partitioning
  • Snapshots can be used to backup and restore the state of the VM (e.g. to recover from damage caused by malware)

Cons

  • Requires sufficient memory (at least 4 GB recommended for a Windows host)
  • Hardware virtualization support (AMD-V or Intel VT-x) is strongly recommended
  • Transferring files in and out of the VM can be tricky
  • Slight performance losses

Any recent (e.g. 2010 or newer) x86-64 PC will likely satisfy the criteria for memory and hardware virtualization.

Enable hardware virtualization

The following steps are based on Windows 8/10 and UEFI:

  1. Open the Start Menu and search PC Settings
  2. Click on the result and a new window will open
  3. On the left pane, click Update and recovery
  4. Under Advanced startup click Restart now
  5. A blue fullscreen window will open labeled Choose an option
  6. Click Troubleshoot
  7. Click Advanced options
  8. Click UEFI Firmware Settings
  9. Click Restart
  10. The computer will reboot into UEFI settings (note: this will vary depending on manufacturer)
  11. Select the Configuration or Advanced tab (use arrow keys to navigate)
  12. Select Virtualization Technology and enable it (with space key or mouse)
  13. Exit and Save (usually F10)

Alternatively, and for older BIOS-based PCs, there is a button combination to hold on reboot to get into the firmware settings; however, it varies per device.

Download a hypervisor and distro

There are several free and paid software packages for virtualization, but Oracle VM VirtualBox is recommended as it is free, (mostly) open-source, and cross-platform. Follow the instructions to download and install VirtualBox for your host OS. If you are using a Professional version of Windows and want to run a 64-bit VM in VirtualBox, make sure Hyper-V is disabled.

If you don't already have a Linux distribution downloaded, this is a good time to do so. A list of popular distros can be found here. Make sure the file you download is a .iso file.

Create the VM

  1. Open VirtualBox (if it isn't already open), and click New.
  2. Type in a name for the VM. VirtualBox tries to select the OS type and version based on the name, but you may have to use the dropdown menus to set it manually. (The choices here help initialize some recommended settings.) Click Next.
  3. Use the slider to set the memory usage for the VM. (Most Linux distros can run just fine with 1 GB of RAM or less; Windows needs at least 2 GB.) Click Next.
  4. Make sure Create a virtual hard disk now is selected, then click Create.
  5. Make sure VDI (VirtualBox Disk Image) is selected (you can select something else if you know what you're doing), then click Next.
  6. If you're asked whether to use Dynamically allocated storage, make sure it is selected, then click Next.
  7. Use the slider to set the maximum storage capacity for the VM. (The default value is usually fine.) Click Create.

Boot and install Linux

  1. In the VirtualBox interface, make sure the VM you created is selected, then click Start.
  2. The first time you start the VM, VirtualBox will ask you to select a disk image to boot from.
    1. Click the folder-and-arrow icon, then find the .iso file you downloaded.
    2. Click Open, then click Start.
  3. Follow the standard instructions for using/installing your distro.

Tips and tricks

Would you like to wrangle virtual machines to make them work for you? Check out the Virtual machine advice page.