Cloud

How to install phpVirtualBox for cloud-based VirtualBox management

The VirtualBox GUI makes it easy to manage your virtual machines. What if you could have a web-based tool that closely resembles that GUI? Find out how that's possible.

cloudnetwork.jpg
Image: iStock/grapestock

If you work with virtual machines (VMs) via VirtualBox, one of the issues you will want to tackle is web-based management. You could opt to go the Virtualmin route, but you might not like the Webmin-based interface.

If you're a fan of the phpMyAdmin tool, you'll be pleased to know there is a VirtualBox remote management system called phpVirtualBox that's based on that outstanding platform. phpVirtualBox is an AJAX implementation of the VirtualBox user interface and offers a web-based interface that is a feature-for-feature drop-in for the standard VirtualBox GUI.

Let's get phpVirtualBox up and running. I assume you have VirtualBox installed and working. My demonstration will be on a Ubuntu 16.04 desktop.

SEE: Quick glossary: Virtualization (Tech Pro Research)

Creating a user

The installation of VirtualBox creates the vboxusers group. We want to create a new system user and add it to the vboxusers group. To do this, follow these steps.

  1. Open a terminal.
  2. Change to the root user with the command sudo su.
  3. Add the new user with the command useradd -m vbox -G vboxusers.
  4. Give the vbox user a password with the command passwd vbox.

For the remainder of the commands, we'll continue to be logged in as the root user.

Enabling vboxwebsrv

Before we enable and start the vboxwebsrv, we must create a new file, /etc/default/virtualbox, with the following contents:

VBOXWEB_USER=vbox

Save and close that file.

Now issue the following commands to enable and start the server:

systemctl enable vboxweb-service
systemctl start vboxweb-service

Installing the software

Now it's time to install the actual software. From that same terminal you've been working in, issue the following command:

apt-get -y install apache2 libapache2-mod-php7.0 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libapr1 php7.0-common php7.0-mysql php7.0-soap php-pear wget

Restart Apache with the following command:

systemctl restart apache2.service

Once the installation is complete, you should have a fully working web server with PHP support.

Now we must download and unpack phpVirtualBox. First, change into the necessary directory with the command cd /var/www/html. Then download the phpVirtualBox file with the command:

wget http://downloads.sourceforge.net/project/phpvirtualbox/phpvirtualbox-5.0-5.zip

Unpack the zip file with the command:

unzip phpvirtualbox-5.0-5.zip

For ease of use, we'll rename the newly created folder with the command:

mv phpvirtualbox-5.0-5 phpvirtualbox

Change into the newly renamed folder with the command:

cd phpvirtualbox

The next step is to create the config file. The developers have made it very easy by adding a sample config file. All you have to do is copy the sample with the command:

cp config.php-example config.php

Open that file and look for the line:

var $password = 'secret';

Change 'secret' to 'PASSWORD' (PASSWORD is the password you set for the vbox user earlier). Save and close that file.

Finally, restart the vboxweb-service with the command:

systemctl restart vboxweb-service

Logging in

Open a browser and point it to http://IP_OF_SERVER/phpvirtualbox (IP_OF_SERVER is the actual IP address of the server hosting phpVirtualBox). You will be prompted for login credentials. The default credentials for phpVirtualBox are admin/admin. Once you've logged in (Figure A), go to File | Change Password to change the password of the admin user.

Figure A

Figure A

The phpVirtualBox main window.

Managing your VMs from the cloud

Congratulations! You can now manage your VMs from the cloud (or, as some would say, a web browser). The phpVirtualBox platform makes this incredibly easy.

If you'd prefer your VirtualBox cloud-based interface to look and feel very similar to the standard client, phpVirtualBox is what you want.

Also see

About Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.

Editor's Picks

Free Newsletters, In your Inbox