I am going to start Dev Tools series of posts with introduction to VirtualBox. This first post about VirtualBox is going to explain what is VirtualBox and general use cases. In the following posts, once you have a basic understanding of the tool and see if this is something that you want to use, we will show how to install and use it. Later, we will go over some advanced set up and show how to share folders and automate set up with tools like Vagrant. For now, lets just focus on the basics.
What is VirtualBox?
As VirtualBox states on about page here, VirtualBox is a general-purpose full virtualizer for x86 hardware, targeted at server, desktop and embedded use. To expand the basic description, lets start with trying to understand what virtualization is. In general, virtualization lets you run multiple virtual computers inside your one physical box. For instance, a computer user may prefer to run Windows for personal use, but would love to write and test code on Linux that is the same as a production environment, VirtualBox lets you do that with ease. Virtual means that it simply is a software that emulates the hardware. Just like running any application on your computer, VirtualBox is a software that runs another operating system. You can install it from ISO, CD or other source within you current OS. It then creates a file on your system as large as you specify, to emulate a hard disk for the Guest Operating System. You can also specify how much resources, such as RAM you want it to use, which will then be shared with your Host Operating System. When started, operating system will launch inside a window just like any other program, as shown in the image below.
Why use VirtualBox?
Just like mentioned earlier, I am a Windows user, however, I like to have development environments that are similar to production. I have several VirtualBox instances and launch whichever one I need at the moment. For instance, I may have apache and php 5 installed on one and nginx and php 7 installed on the other. I may have a new personal project on the third and a client project on forth. I like to separate my projects into different boxes. It makes it easy for me as a developer and keeps my original (host) operating system clean, saving me a lot of headache. I do, however, like to keep my project files and folder on a host machine and share those folders with appropriate VirtualBox instances, which makes it very convenient. Basically, you can write code in your IDE of choice on a Host machine in Windows and have the code available immediately in Ubuntu VirtualBox, which makes it really easy to test real time on Linux.
I also like to share VirtualBox configurations with other developers. We will cover it in later posts, but for now lets just say that having a configuration for your exact virtual machine can be easily transferred to another box, which can save a lot of time during team development.
There are other tools available for virtualization, such as Docker and VMware. Some people prefer one over another, but let’s leave this discussion for later. Right now, we are just trying to understand what virtualization is. VirtualBox makes it easy and I hope that you got the basic idea what Virtual Environment is. We will cover installation of VirtualBox and Guest Operating System in the next series of posts and personally get to know how it works.
Our next post, VirtualBox Setup and Configuration, covers the installation and basic setup of the program.