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.
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.
- Open a terminal.
- Change to the root user with the command sudo su.
- Add the new user with the command useradd -m vbox -G vboxusers.
- 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.
Before we enable and start the vboxwebsrv, we must create a new file, /etc/default/virtualbox, with the following contents:
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:
Unpack the zip file with the command:
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:
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
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.
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.
- How to add new drives to a VirtualBox virtual machine (TechRepublic)
- How to create multiple NAT Networks in VirtualBox (TechRepublic)
- How to run VirtualBox virtual machines from the command line (TechRepublic)
- How to move VirtualBox VMs from one drive to another (TechRepublic)
- Red Hat finds virtualization vital for enterprise despite container competition (ZDNet)