The work required of large-scale development often crosses into a realm where hardware is prohibitively expensive for building simple but proficient testing. An eloquent way to counter this is virtualization. With software such as Virtualbox, Vagrant, or other related aids in virtualization, we can effectively test the deployment of large scale applications.
This article will go over:
- creating a template to quickly create new nodes
- constructing the network for each of the nodes to communicate
- creating a shared folder across all nodes
CAVEATS: Keep in mind that this is a fast and simple method for deploying a cluster for testing, but has several significant security flaws in addition to numerous personal touches that different workflows may need. I simply am describing the bare-bones setup of a cluster.
Building your template node.
I find that it is best to start with a single virtualized guest, install all necessary software and make copies of the virtual machine. This has the drawback of storage required for each additional guest virtual machine but the benefit of only installing your software a single time. In addition, this will result in faster execution times and read speeds for your set of executables. This is all very important if you want to deploy many nodes.
First, you will need to choose the operating system that you wish to deploy. I am most familiar with Ubuntu and will be specifically deploying ubuntu 16.04.
You can obtain a copy of Ubuntu at the following url:
https://www.ubuntu.com/download/desktop
You will also need a virtualization software. I will be using VirtualBox from Oracle. Like Ubuntu, it is free to use.
With VirtualBox, you simply need to select new and fill in the following:
Next, choose the amount of memory. I find at least two gigabytes provides the best performance for desktop ubuntu, though keep in mind you will need enough RAM for all of your virtualized machines in addition to your host OS. Please note that lighter versions of linux would be better suited for most workloads in order to free up resources.

Then create a virtual hard disk, in which you will again need to account for how many nodes you are simulating.

I choose .vdi and ten gigabytes dynamically allocated for my drives. This can all change based on the needs of your application.
Now boot up your new node and configure all of your settings, updates, and installations.
Set up the network for the cluster
One of the most important characteristics for building a cluster is creating the network that allows the nodes to communicate with one another. This can be done by setting up the DHCP server that VirtualBox comes with.
Got to File>Preferences>Network>Host-only Networks and create a new adapter:

Use the following settings.
This will provide all of your nodes with a set of addresses between 192.168.56.101 through 192.168.56.254
Now it is time to enable the adapter.
In the main VirtualBox Manager, select the template node and click settings:
Within settings, select network and on "Adapter 1" choose the following:
and on "Adapter 2" choose the following:
Create a shared folder across all nodes
For a quick setup of a shared folder across several nodes go to the settings of your template node and go to "Shared Folders". Click the new folder and select which folder on your Host system you would like shared across each of your nodes. I chose to check the "automount" and "make permanent" boxes to suit my needs as shown,
Now your shared folder should be available once you start up your virtual machine. Use the following commands to place an accessible link in your home directory. Enter these commands in a terminal. (replace <user> with your user
<user>@node-00:~$ sudo usermod -aG vboxsf <user>
<user>@node-00:~$ ln -s /media/sf_scratch /home/<user>/scratch_shared
This will place a folder (its actually a link) called "scratch_shared" in your home directory and allow you to place files that need to be accessed across the nodes into this single location.
Special Note: If running on windows and you wish to make links in the shared directory, you will have to use the following command to allow this feature and in my case I was forced to run VirtualBox in Administrator mode. This allows for executables to be compiled and installed within the shared folder. A very useful option when needed.
C:\Program Files\Oracle\VirtualBox> VBoxManage.exe setextradata node_00 VBoxInternal2/SharedFoldersEnableSymlinksCreate/scratch 1
Thanks for reading and I hope it helped. Let me know if there are any improvements I can make. I hope my laying it out made it more trivial than when I was attempting to accomplish all of these tasks.