There’s something refreshing about installing a new operating system onto a computer. And now, it’s easier than ever to do it without wiping out your existing setup.
Whether you want to learn bash scripting, try out a new program, or test hardware compatibility, running a Linux virtual machine (VM) will get you there. Best of all, it takes just a few minutes to do.
Before we really get going, there’s an important distinction to make about terminology. When it comes to virtualization, the operating system you already have is the host OS. The one you are installing is the guest. Simple, right?
Also, now is a good time to take a moment and decide whether you will create a fixed size or dynamically allocated virtual hard drive for your VM.
The difference is pretty straightforward: a fixed-size drive carves out a specific amount of storage space for the guest OS, while a dynamically allocated drive will expand the space as needed. Depending on your use of the VM, you should be able to decide pretty easily if you can predict the physical storage space needed. Although there are ways to resolve issues later (such as increasing a virtual disk’s space limit), it’s much easier to make the right decision from the get-go.
All set? Let’s get started.
1. Install VirtualBox
VirtualBox is a free program provided by Oracle. This is the software that powers the entire virtualization process, so go ahead and download it here if you haven’t already and then install it.
2. Download Linux
Next, you’ll need to track down a version of Linux that suits your needs. This is easier said than done.
There are a vast number of distributions that you can choose from. You can start with this article for help defining your specific needs and refer to this one for a quick rundown of some popular options.
Once you find the version you want to try, download the installation file. You should end up with an ISO file in your Downloads folder.
3. Set Up Your Virtual Machine
Now that you have VirtualBox installed and Linux downloaded, it’s time to get your guest OS set up. Open VirtualBox, click New, and use the following steps as a guide:
- Name and operating system. Give the VM a name, choose Linux from the Type dropdown, and select the Linux version as indicated. Go with Other Linux if your distribution isn’t listed.
- Memory size. Select the memory size. This will siphon RAM from your system for the VM, so don’t overdo it. This number can be changed easily later under the VM settings menu.
- Hard drive. Since we’re starting fresh, leave it on the default Create a virtual hard drive now.
- Hard drive file type. There are multiple choices here for advanced users. Choose VDI for now unless you know you will need one of the other options.
- Storage on physical hard drive. Based on your decision earlier, select either Dynamically allocated for an expandable drive file or Fixed size for a static drive file. As the description states, please note that a dynamic drive file will expand as needed, but will not shrink again automatically when space on it is freed.
- File location and size. Since you’re making a virtual hard drive within your existing file space, you can give this file a name and choose where it is stored. Adjust the slider or type in a specific number in the box to the right to specify the virtual hard drive size.
In VirtualBox, you should now see that there is an item on the left-hand side listing your name from step 1 followed by Powered Off. Let’s go ahead and get it powered on.
4. Install the Linux OS
We’ve set the stage for the new guest operating system, but it still needs to be installed. Select your new VM on the left and click Start at the top.
The next window will prompt you to select a start-up disk for the VM. Click on the icon next to the dropdown to open a file explorer window, then track down the Linux ISO you downloaded earlier.
Once you have selected the file, click Start. This will take you to the boot-up options for the OS, and from here you can simply follow the prompts. Many Linux distributions will give you the option to try the software or outright install it – keep in mind that you have set up a virtual disk drive for this VM and you will not be affecting your files on the host machine by installing the new OS.
Once the installation is complete, you’re all set!
Guest additions. Some integrations with a Linux virtual machine can be tricky due to display drivers and other hardware dependencies. To resolve some of these issues, VirtualBox comes with a guest additions ISO image. Once you have the Linux OS installed and running, go to the menu items at the top, click on Devices, then click on Insert Guest Additions CD image… to install them. My 64-bit Ubuntu installation insisted on using a fixed screen size and resolution until I installed the guest additions and restarted the VM.
Consider going light. Unless you have plenty of processing power to spare, consider going with a lightweight distribution that is easy on your system’s resources. Look for variants of popular distributions such as Ubuntu, Fedora or Mint that include a desktop environment that will be less resource intensive. LXDE and Xfce are popular options and worked well for me in my VMs.
Troubleshooting. If you’re having trouble running a particular distribution, you can try wiping the installation and trying again, searching for a solution online, or using another version altogether.