Virtualization refers to the creation of virtual versions of otherwise physical hardware. What does this mean for you? Virtualization allows the creation of "Virtual Machines" (or VMs for short), which in essence allows you to create a virtual version of a real computer inside your physical computer. You can think of it as a computer inside of a computer. But how and why could this benefit you?

There are many reasons why one would need to run a simulation of a real computer. The most common uses are: running a separate operating system on top of your native operating system; testing how an application will perform on a different operating system or different version of an operating system that is not currently installed; and creating an isolated environment for separating yourself from your identity while browsing the web. A common method of learning how to use Linux operating systems is to first install it into a VM and teach yourself in an environment where any mistakes do not affect your native OS. Though this might sound complicated to a newcomer, the setup is actually very fast and simple.

The first thing you'll want to do is to download the software needed for creating VMs. I recommend using Oracle's VirtualBox and will provide a tutorial for it. You can download VirtualBox from https://www.virtualbox.org. Click the big green download button and under "VirtualBox platform packages" and select "Windows Hosts" once the page redirects. Once your download is finished, just click through the setup wizard and allow it the permissions it wants.

Next, you'll want to download the .iso file for your operating system of choice. ISO files are bootable images of operating systems, they contain all that is necessary to install an OS. To find these files you can just search for "Windows 10 ISO" or whatever operating system you want to install in your search engine.

Installing an ISO might take a little while since they are usually over 1 GB—the current version of Windows 10 being almost 5. Here are a list a links for downloading the ISO of a few operating systems:

Windows 10 — https://www.microsoft.com/en-ca/software-download/windows10ISO

Windows XP — https://pcriver.com/operating-systems/windows-xp-professional-iso-download.html/

Ubuntu 18 — https://ubuntu.com/download/desktop/thank-you?country=CA&version=18.04.3&architecture=amd64

Ubuntu Minimal — https://help.ubuntu.com/community/Installation/MinimalCD

Congratulations, you now have everything you need into install an operating system inside a virtual machine. But before I walk you through the best practices of setting everything up, you should check that you have the required computing resources to run it.

When creating a virtual machine, it is crucial to take into account how much of your computer's resources you can allow it to use. If you have under 8 GB of RAM installed in your computer, it might not be a good idea to run virtual machines since they can cost a lot of resources. If you have atleast an Intel i5 or AMD Ryzen 5 with 8 GB of RAM, you should be fine. However, there are some specs you should check to ensure the performance of your virtual machines.

The things you should take a note of are:

  • the number of cores your CPU has
  • the amount of RAM you have installed
  • the amount of harddrive space you have available

You can check these easily by right clicking your Windows home button and selecting "System" at the top of the menu that appears. You can also find out in your Virtual Machine's settings—you'll see this later.

The recommended amount of resources required to run a virtual machine varies from operating system to operating system. In general, Windows 7-10 VMs are very resource intensive while Windows XP and below are less resource intensive. Most desktop Linux distros require much fewer resources than Windows. Futhermore, server-based Linux distros take even less resources than their desktop counterparts and this is because of the lack of a graphical user interface.

I'll list some example specifications you can reference when setting up certain operating systems inside virtual machines.

For general Linux distros being used casually, it is recommended to allocate:

  • 1-2 GB of RAM
  • 1 CPU core
  • 25-40 GB of HDD

For setting up a Linux virtual workstation, it is recommended to allocate:

  • 2-3 GB of RAM (4 is a bit overkill)
  • 2 CPU cores
  • 30-80 GB of HDD

For a reasonably fast Windows 10, it is recommended to allocate:

  • 4 GB of RAM
  • 2 or more CPU cores
  • 50-100 GB of HDD or 40-60 GB of SSD

Alright, enough delay. Let's setup your virtual machine.

First, you'll want to click "new" in VirtualBox, select your operating system and name it. You have the option of choosing Windows, Linux, BSD, Mac, and other varieties of operating systems. Make sure to select the 64-bit options, because the 64-bit programs you'll want to use will not work on 32-bit systems. Click next when you're finished.

This menu will appear.

Next, you'll want to allocate the memory for your VM. Don't allocate all of your memory, that will more than likely cause a system crash. Stick to the guidelines I've given you above. Click next.

Next, just skip through this menu. There is nothing you need to change here.

You can skip through this menu too. VDI is almost always the type of disk you want.

Here, you are presented with two options for the storage settings of your VM: dynamically allocated and fixed size. "Dynamically allocated" storage allows your VM to grow in size on your computer as more files are added inside it, the total amount you allocate is not immediately applied. If you delete files from the VM, the size does not decrease, just so you know. "Fixed size" takes up the space you allocate right away. Fixed is faster because there is no dynamic allocation going on, but may pose a problem to people who don't have a lot of storage. Choose dynamic if you're not sure and click next.

Here you'll allocate the maximum size of your VM. Follow the guidelines so you don't allocate too little nor too much.

That's it! You've just created your first virtual machine. You can't boot it yet though. I'll show you how to do that right now.

Select your VM if it isn't already selected and click "Settings". Click on "System" to start configuring your virtual machine. In "Motherboard", you have the options of: memory, boot order, extended features and very niche settings such as chipset. You can adjust the amount of memory you've allocated here. If you're experiencing bad performance inside your VM, you can always increase (or decrease) your allocated memory. You don't really have to worry about the rest of the options; just leave them how they are.

In "Processor",  you have the options of: processor cores, execution cap and PAE/NX. By "Processor(s)", they mean processor cores. Adding more processor cores will allow for faster computations inside your VM. Adding too many processor cores might cause a system crash. Remember, stick to the guidelines. What you definitely will want to select is "PAE/NX". PAE stands for Physical Address Extension and enables support for more much higher memory addresses, effectively allowing you to install more memory. Some operating systems, require PAE support to even run. Always enable this. You don't have to bother with execution cap.

Next, in your sidebar, select "Display". There are three tabbed menus under Display, but the only one we really need to talk about is "Screen". Screen contains the options for: video memory, monitor count, scale factor and hardware acceleration. Crank your video memory as high as possible if you plan on using a graphical operating system. Both Linux and Windows allow for a max of 128 MB of video memory. Enabling 3D acceleration on Windows allows you to double your max to 256 GB, the same is not true on Linux. You don't have to worry about anything else right now.

Select "Network" on the sidebar. You have the option of enabling up to 4 network interfaces for your VM. Since the average user will only really need 1, that's all we're going to configure right now. In the "Attached To" drop down, you have many options for the type of network adapter you want to use. We will only concern ourselves with 3 of the types: NAT, bridged and host-only.

NAT stands for Network Address Translation. NAT is the default and doesn't have to be changed if you don't want to. For the sake of brevity, NAT essentially creates an isolated virtual network that can really only handle outgoing traffic (by default). NAT works great but if you want to be able to connect to your virtual machine from your real computer for SSH, FTP or having your VM serve as a web server...there is another option.

Bridged adapters allow you to connect to your router and act as though your virtual machine is another physical machine on your network. If you intend to run a server or start a virtual lab, your best bet is to go with the bridged adapter.

Lastly, Host-only adapters make your virtual machine present on your host to connect to (hence the name) but grants it no connection to the outside world. This is useful to people who are playing CTFs (vulnerable machines that you can learn to hack with) or have already installed everything they need for their personal work in say software or web development.

Please note that you can enable up to 4 different adapters at the same time. You can easily switch from Bridged to Host-only to whatever you need from the network manager inside your virtual environment.

The final thing you need to set up to have a working virtual environment is your bootable ISO file. Select "Storage" in your sidebar. You should see an empty disk under a SATA controller for Windows or IDE controller for Linux. Click on the disk icon to the right of the "Optical Drive" option and select your ISO file in Windows File Explorer.

Here's what your storage menu should look like for Windows.

We're done setting up your virtual machine now. Boot it and complete the standard installation process. If you are asked to "Press any key to boot"; just leave it, it will boot automatically. If you are asked to "Please remove installation media"; turn off your virtual machine, open the storage menu again in settings and remove the disk by right clicking it and selecting the remove option.

WAIT THERE'S A PROBLEM!! MY SCREEN IS TOO SMALL, I WANT BIGGER SCREEN!!! This is a common issue. You just need to install VirtualBox Guest Additions for your operating system. This can be as simple as clicking "Devices" and then "Insert Guest Additions CD Image", locating the drive in your file explorer and entering it. Reboot your system and wait a few seconds for the drivers to kick in. This works fine on Windows. On Linux, you might need to do some extra stuff.

To do this on Linux, enter these commands—anything after a # is a comment:

sudo apt install build-essential linux-headers-$(uname -r)
cd /media/cdrom0
ls # To check if the disk has the files you want yet.
sudo sh ./VBoxLinuxAdditions.run
sudo reboot

And there you have it, how to create and set up a virtual environment with VirtualBox. If you liked this article, please consider subscribing to The Daily Shitter for more helpful aricles just like this one. Happy hacking!