Brian Padgett's picture

Hi everyone,

I have been enjoying the fruits of this forumn and the Turnkey virtual appliances for a couple of years now. I figured it was hi time I give back a little. It's not very much but I hope it will help someone looking to setup their own headless virtualbox host. 

Maybe it would be possible to get this in the Virtual appliance lineup at some point.

Here we go...

VirtualBox 4.2 and phpVirtualBox on Turnkey Lamp 12.1 Debian Squeeze

Installing VirtualBox 4.2 


We need to add the Debian repository for add the public key and install VirtualBox 4.2

nano /etc/apt/sources.list

deb squeeze contrib non-free


Run the following commands:

wget -q -O- | apt-key add -

apt-get update

apt-get install virtualbox-4.2


For different versions of Debian you can use the following repositories

deb precise contrib

deb oneiric contrib

deb natty contrib

deb maverick contrib non-free

deb lucid contrib non-free

deb karmic contrib non-free

deb hardy contrib non-free

deb wheezy contrib

deb squeeze contrib non-free

deb lenny contrib non-free


Now we need to install VirtualBox Extension Pack

cd /tmp


VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.18-88780.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

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

vi /etc/default/virtualbox



Next we need to set vboxweb-service to start on boot

update-rc.d vboxweb-service defaults

/etc/init.d/vboxweb-service start


Using Dotdeb for PHP5 repository to update PHP.


1. Add the main repository to your sources.listAdd these two lines to your /etc/apt/sources.list file

deb squeeze all

deb-src squeeze all

2. Fetch and install the GnuPG key


cat dotdeb.gpg | sudo apt-key add -

3. Update

apt-get update

Installing phpVirtualBox 

We are going to install or update the following to support phpVirtualBox

apt-get install php5-common php5-mysql php5-suhosin php5-fpm php-pear


Now we are going to install phpVirtualBox

cd /var/www



mv phpvirtualbox-4.2-0b 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

vi config.php

/* Username / Password for system user that runs VirtualBox */

var $username = 'vbox';

var $password = 'yourpassword';


Now open your browser and point it to:


To login, you will need to use admin for the user and admin for the password. Don't ask me why. 
I have not resolved that issue yet. Once you login, you should obviously change your password 
from the menu bar FILE> CHANGE PASSWORD.


That's it! Enjoy!


I also edited my index.php file to add PHPVirtualBox to the default Turnkey Control Panel.

Here's the code for that.



<html lang="en">


        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

        <meta http-equiv="Content-Style-Type" content="text/css">

        <meta http-equiv="Content-Script-Type" content="text/javascript">


        <title>TurnKey PHPVirtualBox</title>


        <link rel="stylesheet" href="css/ui.tabs.css" type="text/css" media="print, projection, screen"/>

        <link rel="stylesheet" href="css/base.css" type="text/css"/>


        <script src="js/jquery-1.2.6.js" type="text/javascript"></script>

        <script src="js/ui.core.js" type="text/javascript"></script>

        <script src="js/ui.tabs.js" type="text/javascript"></script>

        <script type="text/javascript">

            $(function() {

                $('#container-1 > ul').tabs({ fx: { opacity: 'toggle'} });






        <h1>TurnKey PHPVirtualBox</h1>


        <div id="container-1">


                <li><a href="#cp"><span>Control Panel</span></a></li>



            <div id="cp">

                <div class="fragment-content">


                        <a href="https://<?php print

                        $_SERVER{'HTTP_HOST'}; ?>:12320"><img

                        src="images/shell.png"/>Web Shell</a>



                        <a href="https://<?php print

                        $_SERVER{'HTTP_HOST'}; ?>:12321"><img




                        <a href="https://<?php print

                        $_SERVER{'HTTP_HOST'}; ?>:12322"><img




                        <a href="https://<?php print

                        $_SERVER{'HTTP_HOST'}; ?>/phpvirtualbox"><img







                    <h2>Resources and references</h2>




                          <a href="/phpinfo.php">Apache PHP information</a>

                          (to disable: rm /var/www/phpinfo.php)



                          <a href="/server-status">Apache server status</a>

                          (to disable: a2dismod status)




                        TurnKey LAMP release notes</a></li>









Brian Padgett's picture

I have been using my new headless virtualbox server for about 24hrs now. I am blown away by the difference in performance over running virtualbox on Windows7 host with exact same hardware. The system is an Intel i5 32Gb DDR3.

Before I would have to run my Turnkey Wordpress VM with up to 3Gb ram to get good performance from the Wordpress site. I could only host about five VMs. If I hosted a sixth VM the Windows7 64bit host would blue screen.

I ran tests for months and could not find a hardware or driver problem. I am convinced it is a bug in Windows7. I have duplicated the blue screen on two other Windows7 systems. I can now run each Turnkey Wordpress VM with only 512Mb and could probrably go less than that and it runs lightning fast. 

Just wanted to share incase anyone else runs into the same issues!

A shout out to the devs. Thanks for all the hard work you guys put in! I am trying to learn how to develop with the TKL Virtual Environment so I can give back a little. A headless virtualbox vm will probrably be my first project.

Jeremy Davis's picture

Personally I prefer ProxmoxVE as OVZ containers use even less resources.... But my preferences aside your contribution is warmly welcome. I know that Rik worked on this some time ago and spoke highly of it...

If you want to push development of this forward and even perhaps have it included in the v13.0 lineup then perhaps have a look at the development page and consider building a v13 (Debian Wheezy) based version with TKLDev.

Regardless, great work :)

Ryan's picture

Not sure your vbox user should have shell access?


useradd -d /home/vbox -m -g vboxusers -s /bin/false vbox

This recipe is far too stale... had all kinds of breakage with the dotdeb packages - conflicts and dependancies that could not be resolved with recent turnkey/wheezy


Would like to see a current recipe as all the phpvirtualbox guides seem to be woefully out of date.





Jeremy Davis's picture

Just having a quick glance over it here's my 2c: It looks to me like the dotdeb bits can be eliminated (just install from repos). I'm not sure about v13.0/Wheezy but php (and php-module) version(s) in (new) v14.0/Jessie should be fine for this to work OOTB. Also php5-suhosin hasn't been in Debian for quite some time. Apparently the important bits of it have been merged into the php5 package so I'd just leave that out. If you get to a point if/where you find you do need it then try install from upstream.

TBH I'd still really like to see this appliance make it into the library... It will probably require users to install the last bit themselves (the VBox "extension pack") because of licensing but otherwise shouldn't be a reason why we couldn't do this... Let us know how you go with it...

Add new comment