This is handy when you need to run software that is only available on one Operating System, for example, if you wanted to run Windows software on your Ubuntu computer or vice versa. The only limitations are RAM and disk space for running each virtual machine.There are two open source options for VirtualBox, one from Ubuntu and the other from Oracle. For this tutorial, we will give you the steps to installing the Oracle option as it is the industry standard. If you have any questions regarding these steps we advise reviewing Oracle’s excellent documentation.
Requirements for Oracle’s VirtualBox
You will need at least 512MB of RAM to run a different Operating System, but likely you will want a lot more say, 2 to 3G of RAM and in general, the more RAM you have, the better the performance of the virtual machine. You will also want to check the minimum RAM requirements of the guest operating system. For any Windows distribution, you will want at least 2G of RAM just for the virtual machine.This also assumes you have a relatively new processor for your server or computer. As for the disk space, this will also vary based upon the distribution that you are using. VirtualBox itself is rather small needing only around 30M of space, but the files for the distribution will vary. For example, with a Windows 10 installation, it’s possible to need more than 10G of disk space. Depending on what you are hoping to do with the virtual machine will determine what size of hard disk you will need on your server, but 150Gis a good size to make sure you have room to grow. In short, while you can do with less regarding VirtualBox, it’s best to add some wiggle room for growth and workability.
Installing Oracle VirtualBox
To start the installation, SSH into your computer and open a terminal as root, then follow these steps:
First, open the following file with your favored text editor (in this example we’ll use vim)
Normally you use the VirtualBox Graphical User Interface (GUI) to manage your virtual machines, but a server does not have a desktop environment/graphics card to use the GUI. Fortunately, VirtualBox comes with a tool called VBoxHeadless that allows you to connect to the virtual machines over a remote desktop connection, so there’s no need for the VirtualBox GUI.When starting the process of creating a new virtual machine, it’s beneficial to begin with the help command to see where you want to go:VBoxManage --helpAnd from here you have officially installed VirtualBox on your server.
Additional Steps for Adding a Virtual Machine
There are the basic commands you will need to use to create a virtual machine on the server . In this example, you will create a Windows XP Virtual Machine on your Ubuntu 16.04 server. And with that, we’ll start a new virtual machine called Windows XP which will run its namesake, Windows XP.
Then make sure the virtual machine has required resources for the operating system, if you are unsure of the minimum requirements for your guest operating system (the virtual machine that you will be installing), its best to check these in the official documentation. In this case, we are adding 4G of RAM to be sure we have plenty of RAM to work with.
VBoxManage modifyvm "Windows XP" --memory 4096 --acpi on --boot1 dvd --nic1 nat
Next create a virtual hard disk for the Operating system, in this case, 10G: