Installing PhpVirtualBox under Ubuntu

December 2016


What is PhpvirtualBox ?


This is an open source implementation via Ajax/PHP. An administration interface intended for use in an Intranet to facilitate the task of system administrators who must manage a virtual computionenvironment without a GUI.

OS platforms


Installing PhpVirtualBox was carried out under an Ubuntu 10.04 LTS server and desktop version.
The version of VirtualBox installed on the OS is the 4.0.12 from Oracle.

For more information on installing virtualbox see this very good tutorial:
http://www.howtoforge.com/virtualbox_ubuntu

Prerequisites

  • Download the appropriate zip file acccording to the version of Virtualbox installed at the following address:

  • Create a folder named 'public_html' in your homedirectory.

mkdir public_html
  • Install the Oracle package:
    • Oracle_VM_VirtualBox_Extension_Pack-4.0.12-72916.vbox-extpack 
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.0.12-72916.vbox-extpack

Load the userdir module in apache2


sudo a2enmod userdir 

Activation


To enable and use 'public_html' folder with php pages, edit the userdir.conf file located in:
sudo nano /etc/apache2/mods-available/userdir.conf
  • Comment the line below with a # in front
    • #AllowOverride FileInfo AuthConfig Limit Indexes
  • Add at the top of the line
    • AllowOverride All

Allow execution of PHP pages

  • Edit the 'php5.conf' file located in:

sudo nano /etc/apache2/mods-available/php5.conf
  • Comment the five lines below, as such:

#<IfModule mod_userdir.c>
#<Directory /home/*/public_html>
#php_admin_value engine Off
#</Directory>
#</IfModule>

Restart apache2 so that it takes all into account


sudo /etc/init.d/apache2 restart (or) service apache2 restart 

Testing a single page in your 'public_html' folder


Create a file called index.php and add these lines inside:
  • cd public_html
  • touch index.php | echo "<?php phpinfo(); ?>" > index.php

Test the page


Launch your web browser and enter the IP address of your server(or hostname):
http://ip_server/~user_name/ 

Unzip the archive and rename it

  • unzip phpvirtualbox-4.0-7.zip -d ~/public_html
  • mv phpvirtualbox-4.0-7 phpvirtualbox
  • cd phpvirtualbox

Rename 'config.php-example' to 'config.php'

  • mv config.php-exemple config.php
  • nano config.php


Change the following lines replace 'vbox' and 'pass' by your 'user_name' and your 'password':
var $username = 'vbox';
var $password = 'pass';

At this point you can also modify the language settings:
var $language = 'fr_fr';

Start the vboxwebsrv executable in a terminal


/usr/lib/virtualbox/vboxwebsrv --background 


The lines below should appear:


Oracle VM VirtualBox web service version 4.0.12 
(C) 2005-2011 Oracle Corporation 
All rights reserved. 
00:00:00.000 main VirtualBox web service 4.0.12 r72916 linux.x86 (Jul 15 2011 16:50:08) release log 
00:00:00.000 main Log opened 2011-08-04T19:35:55.956308000Z 
00:00:00.000 main OS Product: Linux 
00:00:00.000 main OS Release: 2.6.32-33-generic 
00:00:00.000 main OS Version: #71-Ubuntu SMP Wed Jul 20 17:30:40 UTC 2011 
00:00:00.000 main OS Service Pack: #71-Ubuntu SMP Wed Jul 20 17:30:40 UTC 2011 
00:00:00.000 main Executable: /usr/lib/virtualbox/vboxwebsrv 
00:00:00.000 main Process ID: 3853 
00:00:00.000 main Package type: LINUX_32BITS_UBUNTU_10_04 
00:00:00.367 SQPmp Socket connection successful: host = default (localhost), port = 18083, master socket = 8 


Test your phpvirtualbox in your web browser


Launch your web browser and enter the IP address of your server (or hostname):

IMPORTANT: The people who put the 'phpvirtualbox' directory in /var/www/ will never see the VM created after first connection.

It is imperative to place this directory in the public_htmlof your homedirectory. That's why the tutorial begins with the activation of the userdir module in apache2.

Enable remote connection to the VM

  • Select the machine you want to start.
  • In Display and select Remote Desktop check box 'Enable server' ports ranging from 3389-4000.
  • Confirm by clicking OK
  • Start your virtual machine by clicking Start and look in 'View' you will see the connecting IP address and port assigned to see that machine.
  • Or simply click on the 'Console' and then click 'Connect'.

Launch a Terminal Server Client

  • Complete fields (eg 192.168.1.11:3389)
  • If it's a Windows based machine then select the 'RDPv5' protocol (for Linux use VNC protocol)
  • If VNCis not installed. You can install it with:
    • sudo apt-get install vncviewer 



You can use "Remote Desktop Viewer 'on the sole condition that the virtual machine allows the remote connection, otherwise the VM will not appear in the Remote Desktop Viewer.
  • Applications -> Internet -> Remote Desktop Viewer


Related :

This document entitled « Installing PhpVirtualBox under Ubuntu » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.