Setting Up The Server
The first step is to set up a server. The hardware you use depends on how many and what kind of virtual servers you are wanting to create. The primary thing to keep in mind is that you want enough power to support the virtual machines you are running. For instance, if you want a run a Linux virtual machine that has 4 gigs ram, 30 gb hard drive, and a single core processor, then you will need to make sure your computer has that to spare.
Here are the simple specs I used for my extremely basic server: quad-core processor, 16 gigs memory, 160 gig hard drive.
This would be a more ideal setup for a more typical server: i7 six-core or octa-core processor, 32 gigs of memory, 2tb hard drive.
Again, this all depends on what type of virtual machines you are wanting to run. As for the operating system on the server, it can be Windows, Mac, or Linux because the Virtualbox software supports all three.
Installing the Virtualization Software
The virtualization software we will be using is VirtualBox, which you can download from here: https://www.virtualbox.org. In order to get the “remote display” feature to work, you will also need to install the VirtualBox Extensions Pack after you have installed VirtualBox.
Once both VirtualBox and the Extensions Pack have been installed, you can begin creating your first VirtualMachine by clicking the “New” button. You can name the new virtual machine whatever you like, and then select what type of OS it will be running. Allocate how much memory you want the virtual machine to have, and then click next to select VDI for the type of hard drive you want, and then click next again.
If you want to use a premade virtual machine instead of installing your own, at this point, you can select an existing VDI image. You can download some free standard linux and Android VDI images from here: http://www.osboxes.org/virtualbox-images/. Otherwise, you can make a new image and select how large you want the hard drive to be.
After the Virtual Machine has been created, you want to select it and click on the “Settings” button at the top. Then select “Display” from the left menu and the “Remote Display” tab. Make sure this is enabled, and remember the port number. Then if you are installing your own OS (instead of downloading one from osboxes.org), click on the “Storage” icon, and change the cd-rom iso image to your installation disk image. Then click “OK” to save and exit the menu.
Now you can select your virtual machine and click “Start” to install or setup the OS software. It should be similar to installing an OS on a new machine. Then you can repeat these steps for however many virtual machines you want. JUST MAKE SURE that each Remote Display port is different for each virtual machine you have.
Setting Up Remote Management Capabilities
At this point, you should already to be able to remote into a virtual machine from another computer. Just make sure the virtual machine is on, and that no firewalls are blocking it, and then on a remote machine, just use Remote Desktop and type in the computers IP address followed by a colon and the Virtual Machines port number.
But one thing all virtual servers have that we’re still missing is a way to remotely manage the Virtual Machines. One potential way to do this is by using PHP VirtualBox. It’s a cool little utility that gives you a web interface for VirtualBox. The only issue is that it requires setting up a PHP SOAP web server, and it takes up a lot of memory when running multiple Virtual Machines.
A less memory intensive way to control your virtual machines is by using the VirtualBox Headless mode. It can run our virtual machines in the background without launching any user interface. To see how it works, you can open up a Run dialog box and type this (replacing “VM NAME” with the name of your virtual machine):
C:\Program Files\Oracle\virtualbox\VBoxHeadless.exe --startvm "VM NAME"
You should see a command line interface verifying that it’s ready to be remoted into. Then to stop it, you can type this command:
C:\Program Files\Oracle\virtualbox\VBoxHeadless.exe controlvm "VM NAME" poweroff
This will kill the virtual machine and close the command line windows. What we can do at this point is take those commands and put them into a batch file to control each of our VM’s. Below is a template I’ve created in Notepad and saved as “menu.bat”. Feel free to use this template, replacing the path names and Virtual Machine names with your own setup requirements.
ECHO OFF CLS :MENU ECHO. ECHO ............................................... ECHO PRESS 1, 2, 4 to select your task, or 5 to EXIT. ECHO ............................................... ECHO. ECHO 1 - Start Virtual Machine 1 (port# 0000) ECHO 2 - Start Virtual Machine 2 (port# 0000) ECHO 3 - Start All VMs Echo 4 - End All VMs ECHO 5 - EXIT ECHO. SET /P M=Type 1, 2, 3, 4 or 5 then press ENTER: IF %M%==1 GOTO VM01 IF %M%==2 GOTO VM02 IF %M%==3 GOTO ALLVMS IF %M%==4 GOTO ENDVMS IF %M%==5 GOTO EOF :VM01 cd "C:\Program Files\Oracle\VirtualBox" start "" VBoxHeadless --startvm "VM01 NAME" GOTO MENU :VM02 cd "C:\Program Files\Oracle\VirtualBox" start "" VBoxHeadless --startvm "VM02 NAME" GOTO MENU :ALLVMS cd "C:\Program Files\Oracle\VirtualBox" start "" VBoxHeadless --startvm "VM01 NAME" start "" VBoxHeadless --startvm "VM02 NAME" :ENDVMS cd "C:\Program Files\Oracle\VirtualBox" start "" VBoxManage.exe controlvm "VM01 NAME" poweroff start "" VBoxManage.exe controlvm "VM02 NAME" poweroff GOTO MENU
To be able to use this remotely, you’ll need to put an SSH server on Windows. I used a simple server called KPYM. You just install and run it and that’s it. It uses the credentials of the logged in Windows user. To remote into it from another Windows machine, you’ll need a free SSH client, such as Putty. Once you have a successful SSH connection, you can browse to your “menu.bat” file and execute it to conrol your VM’s!