Pair programming with VirtualBox
August 11, 2013 — Bryan Allred
What is the need?
In some forms of development it is more beneficial to screen share than to limit the sharing to a terminal or just source code while pair programming. This is especially useful when programming on the Microsoft stack (specifically SharePoint development) where a lot of design and development is done outside of source controlled files.
Here is a quick list of benefits:
- Allows machines to run in “headless” mode reducing computing load
- Enables easy sharing between remote team members
- Removes dependency of transferring virtual machines between servers
- Freedom to take more vacations as long as you have an internet connection
Get the files
If you currently do not virtualize your development we strongly urge you take an hour to investigate its worth. While at first it may feel like overkill the long term benefits are apparent once you start using it.
A great free, and open source, virtualization software is VirtualBox. Here are the packages you will need
- VirtualBox (as of this writing we are using version 4.2.16)
- VirtualBox Extension Pack
Order of operations
Install the VirtualBox Extension Pack
Installation of the extension pack is fairly straight forward. If you are doing this from the desktop environment simply double-click on your downloaded package and step through the wizard.
For command line enthusiasts use the following command:
VBoxManage extpack install /path/to/extpack
Configuration for VRDP
The pointy-clicky people can open the VirtualBox Manager. Open the settings of the virtual machine you wish to configure and go to Display. Under the “Remote Display” section there are various settings to set, but here are the basic settings you should configure:
- Enable the server
- Set a server port
- Allow multiple connections
Alternatively you may modify your virtual machine from the command line to support VRDP, set the port, and allow multiple connections all in one command:
VBoxManage modifyvm "Virtual Machine Name" --vrde on --vrdeport 5001 --vrdemulticon on
Start the VM
For the demonstration we will start the virtual machine in “headless” mode. From the VirtualBox Manager select the virtual machine and while holding down the Shift key start your guest machine.
Again, this may be done from the command line:
VBoxManage startvm "Virtual Machine Name" --type headless
Important: It is important to note that by default when running virtual machines in headless mode VRDP is turned on.
Connect!
Finally test the RDP connection using your favorite RDP client. On Arch Linux we’ll demonstrate using RDesktop:
rdesktop -K -N localhost:5001
For the Linux crowd note the “-N” allows the NumPad and the “-K” tells the program to not override window manager key bindings. The last setting is important if you are a heavy keyboard user or your window manager is keyboard driven!
For the adventurous
There are additional packages which may be installed to use VNC rather than RDP. For the sake of this article we wanted to demonstrate the ease of getting set up. However, there are multiple advantages which may be cited using VNC over the default.
Also, this article did not describe setting up any authentication. It is highly recommended to configure some form of authentication! Not doing so not only runs your system but also runs your customers product at risk.