Poor Mans Virtualized Server
IT Budgets in Pacific Island countries are quite limited. In the Cook Islands, IT budget items are the very first things to be cut. Therefore the use of innovative ways of utilizing existing resources and maximizing efficiency become important.
One way of doing this is to turn old PC’s, most with decent amounts of processing power into mini virtualized servers. The problem is most serious virtualized solutions require specialized investment in server hardware which in most cases is out of the reach of most of us working in the Pacific Islands. So what can we do?
The Solution
Build a Poor Mans Virtualized Server. In this tutorial we will look at setting up a headless VirtualBox server with phpVirtualBox for remote management running on Turnkey Linux LAMP. Since Virtualbox can run on any standard hardware you can re-purpose old [or new] desktop PC’s into virtualized servers.
This is based on TurnkeyLinux LAMP Wheezy 13.0 and Virtualbox 4.3.1 (Wheezy Backports)
Install Turnkey Linux LAMP
For instructions on how to install, please follow the tutorial here. http://ciiag.org/index.php/tutorials/219-installing-a-turnkey-lamp-server
Installing VirtualBox
We need to add the TurnkeyLinux repository for add the public key and install VirtualBox
nano /etc/apt/sources.list.d/sources.list
deb http://http.debian.net/debian/ wheezy-backports main contrib
Run the following commands:
apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,')
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | apt-key add -
apt-get update
apt-get -t wheezy-backports install virtualbox
Install VirtualBox Extension Pack
Now we need to install VirtualBox Extension Pack. The extension pack allows for VirtualBox Remote Desktop Protocol (VRDP) support, The virtual USB 2.0 (EHCI) device, Intel PXE boot ROM with support for the E1000 network card and Experimental support for PCI passthrough on Linux hosts
cd /tmp
wget http://dlc-cdn.sun.com/virtualbox/4.3.18/Oracle_VM_VirtualBox_Extension_Pack-4.3.18.vbox-extpack
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.18.vbox-extpack
We need to create vbox user for VirtualBox and phpVirtualBox and add it to vboxusers group
useradd -d /home/vbox -m -g vboxusers -s /bin/bash vbox
Set a password for the user, in this case vbox
passwd vbox
Create the file /etc/default/virtualbox and put the following lines so that the VirtualBox SOAP API which is called vboxwebsrv runs as the user vbox
nano /etc/default/virtualbox
VBOXWEB_USER=vbox
Next we need to set vboxweb-service to start on boot
update-rc.d vboxweb-service defaults
/etc/init.d/vboxweb-service start
Installing phpVirtualBox
Now we are going to install phpVirtualBox
cd /var/www/
wget http://sourceforge.net/projects/phpvirtualbox/files/phpvirtualbox-4.3-1.zip/download
unzip phpvirtualbox-4.3-1.zip
mv phpvirtualbox-4.3-1 phpvirtualbox
Copy the config file and set the user and password for your vbox user
cd /var/www/phpvirtualbox/
cp config.php-example config.php
nano config.php
/* Username / Password for system user that runs VirtualBox */
var $username = 'vbox';
var $password = 'yourpassword';
That’s it. Open your browser and login using the default
username: adminpassword: admin
Make sure to change the default passwords
Issues and Workarounds
We had numerous issues because we were behind a firewall, here were our workarounds.
Instructions for being behind a proxy [Optional]
If you are behind a firewall, do this first. Note that we did experience some issues with wget and used a workaround (see issues) but it’s best to let the network administrator know what you are trying to do. In our experience it’s best to do this without a firewall in the way.
nano /etc/apt/apt.conf.d/01turnkey
add the line
Acquire::http::Proxy "http://username:password@proxyserver:port";
where
- username = your own username
- password = your own password
- proxyserver = IP Address of your proxy server
- port = port of your proxy server
Wget blocked by firewall
Had issues with wget being blocked by our proxy server but we used our windows machine to download the files we needed and then re-uploaded them to the host machine using webmin.