VirtualBox is one of the tools that are used for Desktop Virtualization : running an OS within the OS. VirtualBox usually installed on the operating system that already has the VirtualBox GUI to manage it. But, how to manage VirtualBox without VirtualBox GUI? VBoxHeadless is the answer if we want to install VirtualBox on minimal Linux server and manage it via Browser.
I’m using openSUSE 12.1 64 bit on this tutorial but the steps can also be applied to earlier versions (11.x) as well as on SLES 11 SP1. I also use VirtualBox for All distributions binary package, although for openSUSE we can also use an RPM-binary package.
Lets get started :
- Install openSUSE 12.1 Minimal Server (Text Mode)
- Installing package for VirtualBox Kernel Modul
1.
zypper
in
kernel-
source
make
gcc gcc-c++ pam-devel kernel-syms SDL
- Download VirtualBox binary package with the Extension Pack fromwww.virtualbox.org
- Install Virtualbox
1.
chmod
+x VirtualBox-4.1.6-74727-Linux_amd64.run
2.
./VirtualBox-4.1.6-74727-Linux_amd64.run
- Install the Extension Pack
1.
chmod
+x Oracle_VM_VirtualBox_Extension_Pack-4.1.6-74713.vbox-extpack
2.
VBoxManage extpack
install
Oracle_VM_VirtualBox_Extension_Pack-4.1.6-74713.vbox-extpack
- Create a user for VirtualBox web access
1.
useradd
vbox
2.
passwd
vbox
3.
New Password : vbox
4.
Reenter New Password : vbox
- Create a VirtualBox web configuration on /etc/default/
1.
vi
/etc/default/virtualbox
with the following contents :
1.
VBOXWEB_USER=vbox
- Install LAMPP server and php5-soap package by using zypper
1.
zypper
in
-t pattern 'lamp_server'
2.
zypper
in
php5-soap
- Edit /etc/apache2/default-server.conf and replace Options None to Options ALLso Apache will display the contents of the directory index
1.
vi
/etc/apache2/default-server.conf
- Download latest phpvirtualbox package
1.
cd
/opt
3.
unzip phpvirtualbox-4.1-5.zip -d /srv/www/htdocs
4.
cd
/srv/www/htdocs
5.
mv
phpvirtualbox-4.1-5 phpvirtualbox
6.
cd
phpvirtualbox
- Rename config.php-example to config.php and modify the contents to an appropriate configuration
1.
var $username = 'vbox';
2.
var $password = 'vbox';
3.
var $location = 'http://192.168.1.111:18083/';
4.
var $consoleHost = '192.168.1.111';
Note : 192.168.1.111 is my VBoxHeadless Server
- Restart web server and run the VirtualBox services
1.
service apache2 restart
2.
vboxwebsrv --host 192.168.1.111 -b
- Open a browser and go to http://VBOXHeadLess-Address/phpvirtualbox, login with the default user: admin with password : admin
On the client side, access the VirtualBox VM by using rdesktop or krdc with following examples :
rdesktop 192.168.1.111:3389
Here is the view of VM on VBoxHeadless, running Minimal Server Appliance.
Note :
- If you encounter an error message: PHP does not have the SOAP extension enabled, install php5-soap package from openSUSE 11.2 OSS repository
- If the Console does not open or error, power off the virtual OS then click on Settings -> Select Display -> Remote Display -> Checklist on the Enable Server and give the port on the Server Port, for example 3389 -> OK then run again. If you have more than one virtual OS, do the similar process and change Server Port to 3390 and so on.