Learn everything you need to know about virtual machines in the ultimate beginner guide to virtual machines. How to create your first virtual machine. The hardware specs and drive space. Learn all the tips and tricks for beginner level skills in virtual machines.
What are Virtual Machines?
Virtual machines let you simulate an entire physical computer and running any operating system you want on it. You can select how much RAM and hard disk space the virtual machine has. You can even simulate inserting a CD or mount an ISO file as if it were a CD. Virtual machines make it easy and affordable to test different operating systems or even just different software without having to slow down your actual computer.
Ever wanted to to test different operating systems but didn’t feel like wiping your hard drive from your existing computer. Maybe you have an old laptop laying around that you can plan around with or maybe you don’t. Well that’s where virtual machines come in.
In this Ultimate Beginner’s Guide to Virtual Machines, I will use some different terminology that you may be unfamiliar with. So for starters, let’s define the terms:
- virtual machine (aka VM) – the simulated computer that is being run completely as software alone
- host machine (aka actual computer) – the physical computer that has actual hardware to operate it. This computer runs the software that is the virtual machine.
Free virtual machine software named VirtualBox
Everybody loves free software, especially if it is good software. For this guide and series, I will be using VirtualBox to run my virtual machines. This freeware is made by Oracle, the creators of Java. So you know the program is good.
You can download the latest version of VirtualBox from their website’s download page. At the time of this aticle, the most recent version is 6.0, but any future updates should be fairly similar.
Create a new virtual machine with VirtualBox
The first step in mastering virtual machines is to create your very own and learn the virtualization software. Once you have VirtualBox installed, we can begin creating out first machine and installing an operating system.
Open VirtualBox and simply press the “New” button on the top toolbar to begin the new machine wizard. The VirtualBox software has a super straight forward wizard for creating new virtual machines. It will walk you through the basic configuration settings for your new virtual machine, including selecting the operating system type, the hard drive size and video memory amount.
The first window will ask to name your new machine and select the operating system type and version. I usually like to keep it simple and just name my virtual machines with the version and type of operating system I am installing (e.g. “Ubuntu Desktop 18.04” or “Windows 10”). After naming it, select the appropriate “Type” and “Version” of the operating system you are installing and click the “Next” button.
Best RAM amount for virtual machines
Next it will be asked to select how much RAM your virtual machine will have. Typically the recommended size is 1024 MB (aka 1 GB), but I usually set my RAM to 2048 MB (aka 2 GB). I often find that when I set the memory to lower amounts, the virtual machine will struggle to run some applications. Keep in mind that different operating systems will have different minimum requirements for RAM. Below you can find a guide that I made for various common operating systems. Click “Next” when you are satisfied.
Hard drive setup for the virtual machine
Getting the correct hard disk capacity is important for virtual machines. VirtualBox will recommend a capacity for the operating system you selected on the previous screen. Do consider what you are going to be using this virtual machine for: are you using it for a small scale testing environment or for full scale server-client virtualization? The great news is you can change the capacity at any point later if you so choose.
Configure the hard drive
The hard disk screen gives you three options to configure your virtual machine’s hard disk. Each of these options have good times when they are needed. If you are using a pre-configured virtual machine that you have downloaded online (one that likely has the operating system already installed on it), then this is where you would select to use that hard disk. If you are creating a brand new virtual machine and plan on installing the operating system yourself, then just keep the default “Create a virtual disk now” option selected, then click “Create”.
Now you will have to select the format of the virtual hard disk. For the most user’s this will not matter. But if you plan on using the same virtual machine’s hard disk file between different virtualization software then you may want to choose a specific format. But for beginners, keep the default and move on.
Next you will be given the two options of how you want the virtual machines hard disk to be stored on your actual machines hard disk. The “Dynamically allocated” options is recommended since it will take up the least amount of space on your actual hard disk. As you install new software and load files onto your virtual machine, a dynamically allocated hard disk will automatically expand as needed. The “Fixed size” option will simply create the virtual hard disk of the size you set the drive capacity to and be set forever.
How much hard drive space for your virtual machine?
Next you will be able to select how much capacity you want the virtual machine to have to operate with. Again, consult the recommended minimum requirements for the operating systems you are planning on using. Once you are satisfied with your selected settings, click the “Create” button and your virtual machine will be created and added to the list of machines on the VirtualBox main window.
Something I would keep in mind is that even after you have created a virtual machine and set the simulated hardware specifications (e.g. amount of RAM and hard drive capacity), we can be altered as many times as you would like. Even if your operating system is already installed. I’ll even show you how to make these changes in one of the sections below.
Installing the Virtual Machine’s Operating System
Now that the virtual machine’s “hardware” has been configured for the virtualization, we are ready to install the operating system. You will need the installation files for your desired operating system. This can be in the form of an actual installation CD or the downloaded ISO file for the operating system. For my machine, I am going to install the latest version of Ubuntu Desktop ISO.
Mount your ISO so the virtual machine can access it
To simulate the ISO as a live CD, select the virtual machine that you just created from the list of the left-hand side of VirtualBox. Under the “Storage” section you will notice button labeled “[Optical Drive] Empty“. Click this button and you will have a list of a few options. If you have loaded any ISOs before for other virtual machines, they will appear in the popup. You can select them or you can browse to find a new ISO by selecting “Choose disk image…”.
You will now notice the “[Optical Drive]” button now says the name of the ISO you selected. If at any time you want to remove or “eject” the ISO/CD, you can click on the button again and simply click the ISO with the check mark next to it. This will simulate you ejecting the CD from the optical drive.
If you want to create a bootable flash drive to install your operating system from, check out my article on UNetBootin. A free cross-platform application to quickly create bootable flash drives.
Once your ISO is selected, click the green “Start” button to boot up your virtual machine. You will notice that the screen size will change a few times as the virtual machine fully boots up. That’s normal. After the machine fully boots, it will begin to load the installation program from the ISO you selected. Simply click through the onscreen options for your installation program to install the operating system.
Operating system tips and selections
Keep in mind that when you get to the portion of the installer where you select your hard disk and partitions to install the operating system, be sure to select the “entire disk” option. This will ONLY use the virtual disk that we created earlier, not your actual computer’s hard disk. So fret not!
If you are looking for some new operating systems to try, here is a list of some various ones that are free for download:
- Ubuntu Desktop or Ubuntu Server – perhaps the most common distribution of linux used. This debian based linux has one of the best user interfaces available for linux
- Linux Mint – another of the more common versions of linux available, Linux Mint aims to “produce a modern, elegant and comfortable operating system which is both powerful and easy to use.”
- Kali Linux – one of the most popular linux based security penetration testing platforms available, coming fully stocked with nearly all the tools ones needs for computer security testing.
- Parrot OS – another linux based penetration testing platform loaded to the brim with tools for security testing. But unlike Kali, Parrot OS also has a lightweight “home edition” that is geared toward the security conscious computer users.
Device inputs to the virtual machine (mouse, keyboard, optical drives)
If you are new to virtualization, it can be somewhat confusing and definitely different than normal to setup and configure the various types of inputs to virtual machines. But the good thing is that most newer software has compatibility with nearly every bit or hardware for keyboards and mouses. They even have smart settings to auto select and know when to use your mouse and keyboard inside of the virtual machine and when to use it on your actual computer.
If you look in the bottom right corner of the running virtual machine, you will see an assortment of colorful icons. All of them give the status of different portions of the virtualization. The last two icons tell you the status of the the mouse and keyboard inputs into the virtual machine.
If the mouse icon is grayed out, then our mouse simulation is not being sent to the virtual machine. Just like for the keyboard, if the keyboard icon’s arrow is grayed out then it is not being simulated on the virtual machine.
Auto detect and auto integration of your keyboard and mouse
By default, VirtualBox will try to smartly determine if the mouse and keyboard signals will be sent to the virtual machine. This is known as the “auto detect” integration feature. To check to see your current auto detect settings, go to “Input” from the top toolbar. The mouse integration status will be at the bottom of the drop down. If it has a check mark, then auto integration is enabled. I would recommend using the auto integration feature, it makes life so much easier!
To view the keyboard auto integration setting, select “Keyboard” -> “Keyboard Settings…”. In the new window, you will see a check box for “Auto capture keyboard”. I highly recommended to have both mouse and keyboard auto captured. This will make is soooo much easier to switch between operating in your virtual machine and using your normal computer.
Problems with keyboard not loading? Adjust the RAM size and video memory!
If you have problems with getting your keyboard to actually send input to the virtual machine, first check to make sure the keyboard auto capture is selected. I have found that this usually corrects the issue. If that does not correct the issue, then try raising the RAM and video memory for the virtual machine.
Power States and what each one means?
Virtual machines have a few different types of “power states” that they can be in, similar to normal computers but still a little different. The simplest of the power states is the powered off state. This one is just as you imagine, the machine is off. Simple. The other option is called a “saved state”. You can think of it as a sort of standby mode, like when you just close your laptop lid and the computer goes into hibernation.
When you close a running machine’s window, you will be given the choice of how to close the virtual machine. Each of the choices are explained below:
- Save the machine state – this will save the current running state of the virtual machine. Think of it as a running snapshot of the machine. All the running applications and services will stay running. The next time you go to start the VM, you will start exactly where you left off. Super convenient!
- Send the shutdown signal – this would be like if you press the power button on your computer. It will run any of the normal shutdown processes for the operating system to turn off the computer.
- Power off the machine – this option would be like holding the power button until the computer turns off. The next time you start your VM, it will run through the entire boot and startup process. Including looking at any mounted ISOs.
Viewing States and Window Sizes
VirtualBox offers a few different viewing modes, called “View states”. These viewing modes may have different times when they are convenient to use. By default you will be in the “adjusted” mode. This will give you the smallest possible application window size to run your virtual machine.
The more commonly used viewing mode is the “scaled” mode. This will give you the feel of a normal application window that you can resize to your hearts content. This mode is super useful since it gets rid of the toolbar and lets you have the size window you want to operate your virtual machine.
If you are a fan of keyboard shortcuts, then you can easily switch between the viewing modes by pressing the “Host key + c”. The Host key by default is the right control button. But this can be whatever you chose. The host key for your machine will be displayed in the bottom right of the virtual machine next to the keyboard state icon.
Sharing folders between a virtual machine and your actual computer
The worst part about virtualization is getting the files you want onto the virtual machine, that is until you learn how to share folders between the virtual machine and the actual computer’s hard drive. And what would the ultimate beginner guide to virtual machines be without showing you how!
Once you select the folder on the host machine, it will appear on the virtual machine as a separate drive. Just like if you connected a USB flash drive to the virtual machine.
From a running machine window, click the “Devices” toolbar option. Then select “Share Folders” -> “Shared folder settings…”. In the popup window, select the “Add new” button on the right hand side.
- Folder path: Simply browse to the folder you want to share between the virtual machine and host machine
- Folder name: the folder name should be auto filled out with the name of the folder from the “folder path”
- Read Only: selecting this option will make the shared folder appear as read only on the virtual machine. This will make it so you can only share files from host to VM, not the other way around. This can be very useful when you are using virtual machines that are infected with virus (for testing purposes like pen-testing) so that the bad software cannot infect the host computer.
- Auto-Mount: selecting this option will make the shared folder automatically connect to the VM. Your new shared folder will be made available to share files immediately.
- Mount-point: think of this as the drive name, as if you labeled the flash drive you connected to the virtual machine.
- Make-permanent: selecting this option will make the shared settings saved for future machine boot sequences.
Mastering virtual machines!
Now that we have a nice understanding of how to get the basics done with virtual machines and VirtualBox, go start playing around with the program. After all, that is the only way you will truly learn how to completely use it! How to master your virtual machines and virtualization.