VirtualBox

From Mark Furneaux's Wiki
Jump to: navigation, search

VirtualBox is an OS level virtualization platform for Linux, Windows, and OS X. It was originally aquired by Sun Microsystems and was absorbed by Oracle.

Installation

Linux

There are 2 versions of VirtualBox, the Open Source Edition (OSE) or the regular version with some closed source components. The OSE lacks many useful features and it is recommended to use the regular edition.

VirtualBox can be downloaded as a .deb package from virtualbox.org, via Virtualbox's offical repositories, or you can install an older version from the official Ubuntu repositories. The optimal installation method is via VirtualBox's offical repositories.

If using repositories on a server or CLI machine, ensure that you do not simply run a regular install. apt by default will install a huge assortment of recommended and suggested packages that are unnecessary.

Add the repository by appending the following line to /etc/apt/sources.list:
deb http://download.virtualbox.org/virtualbox/debian <distribution> contrib
remembering to set the distribution being used.

Download and import the key by running:
# wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | apt-key add -

Update the package list and install VirtualBox by running:
# apt-get update && apt-get install --no-install-recommends --no-install-suggests virtualbox-X.X
where X.X is the latest version of VirtualBox (or version you wish to install).

Extension Pack

In order for features such as RDP to work, you must install the VirtualBox Extension Pack from virtualbox.org.

To install the package, run:
# VBoxManage extpack install <extpack>

phpVirtualBox

phpVirtualBox is a package for a web server which allows remote administration via a web GUI similar to that of the interface in the GUI version of VirtualBox.

Web Server

In order for phpVirtualBox to function, VirtualBox needs to have a web server running on the host for it to connect to. This should be run as a user which only has permissions to work with VMs, so it is best to dedicate a new user to this task.

Create a new user 'vbox' to use in running the web server, and give it permissions to read and write to the directories used for the VMs and VHDs.

To run the web server at system startup, add the following to the end of /etc/rc.local:

/bin/su -c "/usr/bin/vboxwebsrv -b" vbox

Installation

Download the package for the version of VirtualBox you are running from sourceforge. Extract it into a directory in the webserver on the machine running VirtualBox.
Rename config.php.example to config.php and edit the username and password fields to the system user setup earlier:

/* Username / Password for system user that runs VirtualBox */
var $username = 'vbox';
var $password = 'password';

The default login is "admin" and "admin" and can be changed from the webUI.

Fixes

If the version of phpVirtualBox is behind the current VirtualBox version, you can get around the version check by editing the file endpoints/api.php:

$response['data']['responseData']['phpvboxver'] = "5.1-0";