Phpvirtualbox

From SME Server
Jump to navigation Jump to search


Phpvirtualbox for SME Server

  Skill level: Medium
The instructions on this page require a basic knowledge of linux.


  Warning:
accordingly the bugzilla:8233 Virtualbox can't be installed on a kernel-PAE (i386), you have to choose either a pure i386 or a x86_64 kernel


Maintainer

Stephane de Labrusse aka stephdl

Description

An open source, AJAX implementation of the VirtualBox user interface written in PHP. As a modern web interface, it allows you to access and control remote VirtualBox instances. phpVirtualBox is designed to allow users to administer VirtualBox in a headless environment - mirroring the VirtualBox GUI through its web interface.

  Note:
Please you should help this project as Ian Moore develops phpVirtualBox in his spare time, free of charge. If you find this program useful, He asks that you please donate.



  Tip:
You can find more informations directly on the phpvirtualbox wiki, please Take a look to the documentation.


Requirements

You need to install the VirtualBox_Repository, the Stephdl_repository And the Epel Repository


  Note:
VirtualBox is a real professional solution to virtualise Operating Systems in Linux, please Read the virtualbox manual if you want to use entirely all features of this software


Installation

You have to be sure that your server has the kernel up-to-date before to install virtualbox, else the installation will fail.

yum install --enablerepo=epel dkms kernel
signal-event post-upgrade;  signal-event reboot

This contrib is currently held in several repositories, so the following commands will install on your smeserver.

yum --enablerepo=stephdl,virtualbox  install smeserver-phpvirtualbox smeserver-virtualbox

You will then need to activate the database changes and to reboot with the new kernel module loaded.

signal-event post-upgrade;  signal-event reboot

Go to the phpvirtualbox panel at the url https://your-sme-ip/phpvirtualbox on your local-network. You can not reach this contrib trought internet. Your credentials are the user admin and the password "admin" but you can add more users by the DB Configuration.


  Tip:
You can see the Tutorial hosted on our Wiki in order to learn :


Kernel Upgrade

After a kernel update and the "signal-event post-upgrade; signal-event reboot", even with the dkms module, the vboxdrv is not loaded because the module is not compiled with the new kernel, so you need to launch this command line in a root terminal.

/etc/init.d/vboxdrv setup; /etc/init.d/vboxweb-service start
Stopping VirtualBox kernel modules                         [  OK  ]
Uninstalling old VirtualBox DKMS kernel modules            [  OK  ]
Trying to register the VirtualBox kernel modules using DKMS[  OK  ]
Starting VirtualBox kernel modules                         [  OK  ]

Installation of Extension Pack

Support for USB 2.0 devices, VirtualBox RDP and PXE boot for Intel cards. See this chapter from the User Manual for an introduction to this Extension Pack. See this page to download the extension pack if the url below is no longer good.

For example :

wget http://dlc.sun.com.edgesuite.net/virtualbox/4.3.0/Oracle_VM_VirtualBox_Extension_Pack-4.3.0-89960.vbox-extpack
vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.0-89960.vbox-extpack

see vboxmanage-extpack for a complete list of commands

  • To add a new extension pack, use VBoxManage extpack install <.vbox-extpack>. This command will fail if an older version of the same extension pack is already installed. The optional --replace parameter can be used to uninstall the old package before the new package is installed.
  • To remove a previously installed extension pack, use VBoxManage extpack uninstall <name>. You can use VBoxManage list extpacks to show the names of the extension packs which are currently installed. The optional --force parameter can be used to override the refusal of an extension pack to be uninstalled.
  • The VBoxManage extpack cleanup command can be used to remove temporary files and directories that may have been left behind if a previous install or uninstall command failed.


BridgeInterface

smeserver-bridge-interface is a small package allowing you to bridge your Internal Interface with one or more virtual tap interfaces. It's main goal is to be used with the new OpenVPN-Bridge contrib, but it has been split in another contrib as it can be used in other situations (if you want to run a virtual machine on your SME Server with virtualbox for example).

see BridgeInterface

Therefore your Guest O.S will have a real ip on your local network, you need to set its virtual NIC on bridged adapter (br0) in phpvirtualbox network settings

DB Configuration

configuration database

# config show phpvirtualbox 
phpvirtualbox=service
   Group=
   Name=phpvirtualbox
   User=admin
   status=enabled
   webauth=disabled

Add a different URL

by example

http://yourserver.net/VB 

or

http://yourserver.net/PVB


  Note:
this adds another url, it doesn't remove the default


config setprop phpvirtualbox URL VB

or

config setprop phpvirtualbox URL PVB

To enable your changes run these commands

expand-template /etc/httpd/conf/httpd.conf
sv h /service/httpd-e-smith
  • If you want to remove completely the new url
config delprop phpvirtualbox URL

then

expand-template /etc/httpd/conf/httpd.conf
sv h /service/httpd-e-smith

Web authentication

you can allow web authentication to phpvirtualbox by doing the command line below. This feature is experimental as there is a bug opened, when it will be solved then this feature will be the default.

config setprop phpvirtualbox webauth enabled
expand-template /etc/httpd/conf/httpd.conf

and you have to modify manually the file config.php

nano /opt/phpvirtualbox/config.php
// Authentication library.
var $authLib = 'Builtin';
#var $authLib = 'WebAuth';
#var $authConfig = array('adminUser' => 'admin');

to

// Authentication library.
#var $authLib = 'Builtin';
var $authLib = 'WebAuth';
var $authConfig = array('adminUser' => 'admin');


Allow Specific Users

The users must be declared and a password must be set in the server-manager.

config setprop phpvirtualbox User "admin user2 user3"
expand-template /etc/httpd/conf/httpd.conf
Allow Specific Groups

These groups must be declared in the server-manager and users need to be included

config setprop phpvirtualbox Group "Group1 Group2 Group3"
expand-template /etc/httpd/conf/httpd.conf

Access The Web Interface Remotely

  Warning:
Instructions below could be a flaw in Phpvirtualbox, you should remotely access trough SSH or with openvpn


Create the following folder if it doesn't exist.

mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/

Copy the file 92phpvirtualhost to the newly created folder.

cp /etc/e-smith/templates/etc/httpd/conf/httpd.conf/92phpvirtualhost /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/

Edit the file and add your public IP address.

nano /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/92phpvirtualhost

Change the line:

$OUT .= "    allow from $localAccess\n";

to the one below (eg. 123.456.789.012 is your public IP address) then save the file.

$OUT .= "    allow from $localAccess 123.456.789.012\n";
expand-template /etc/httpd/conf/httpd.conf
svc -t /service/httpd-e-smith/
svc -t /service/httpd-admin/

Uninstall

yum remove smeserver-virtualbox smeserver-phpvirtualbox phpvirtualbox VirtualBox-4.3 dkms

Bugs

Please raise bugs under the SME-Contribs section in bugzilla and select the smeserver-phpvirtualbox component or use this link .

SME guest server configuration

To optimize and/or fine-tune your SME guest server running on your phpvirtualbox host, please see our Virtual SME Server wiki page

For general information on how to configure phpvirtualbox guests please visit the phpvirtualbox documentation