This brief tutorial shows students and new users how to manage VirtualBox on a remote Ubuntu server with phpVirtualBox.
Again, we’ve discussed this many times. If you’re planning to be an IT professional or working on your exams, one very important tool to have handy is a virtualization software.
Virtualization software like VirtualBox and VMware Workstation Pro or VMware Players allow users to run multiple guest operating systems simultaneously on a single host computer.
We’ve also described instructions to install these popular virtualization software on Ubuntu and Windows systems on this website.
Since we’ve already shown you how to install VirtualBox, this brief tutorial shows users how to install phpVirtualBox to manage VirtualBox software on a remote server, aka headless server.
step 1: Prerequisites
Before you can install phpVirtualBox, you must first install VirtualBox. The link below shows you how to do just that.
Now that VirtualBox is installed, your next step is to get phpVirtualBox installed.
Step 2: Apache2 Server
The phpVirtualBox uses Apache2 server to manage the host. So, one of the requirements to get this working is to install Apache2. To learn how to install Apache2, read the post below:
Step 3: Install PHP and its modules
Your next step is to install PHP and other PHP modules. More about PHP can be found from the post below.
To install PHP and required modules to get phpVirtualBox working on Ubuntu, run the commands below.
sudo apt-get install php sudo apt-get install libapache2-mod-php libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libapr1 php-common php-mysql php-soap php-pear
Step 4: Install phpVirtualBox
The next step is to install phpVirtualBox. To do that, run the commands below to download phpVirtualBox packages.
cd /tmp && wget https://sourceforge.net/projects/phpvirtualbox/files/phpvirtualbox-5.0-5.zip
Then run the commands below to extract the downloaded packages.
Step 5: Configuring phpVirtualBox
Next, copy phpVirtualBox content to a folder in Apache2 root directory, but first create directory called phpvirtualbox.
sudo mkdir -p /var/www/html/phpvirtualbox sudo mv phpvirtualbox-5.0-5/* /var/www/html/phpvirtualbox/
Next, create phpVirtualBox config file from the sample file by running the commands below.
sudo cp /var/www/html/phpvirtualbox/config.php-example /var/www/html/phpvirtualbox/config.php
Step 6: ADd phpVirtualBox dedicated user account
phpVirtualBox requires dedicated user account to function. For that, you need to create a service account.
To create a service account, run the commands below.
sudo useradd phpvbox sudo passwd phpvbox
Then add vboxuser to existing VirtualBox user account
sudo usermod -aG vboxusers phpvbox
Step 7: Setup phpVirtulBox connection
The final step is to configure phpVirtualBox user connection. This can be done by opening its default configuration file and adding phpvbox user to the settings.
Open and edit the file by running the commands below:
sudo nano /var/www/html/phpvirtualbox/config.php
Then fill in the user account for phpvbox as shown below.
/* Username / Password for system user that runs VirtualBox */
var $username = ‘phpvbox‘;
var $password = ‘phpvbox_password‘;
Next, run the commands below to create a new phpVirtualBox in the /etc/default directory.
sudo nano /etc/default/virtualbox
Then add this line in the file and save it. This allows VirtualBox SOAP API service to run as phpvbox.
Start the phpVirtualBox service account by running the commands below.
sudo systemctl enable vboxweb-service sudo systemctl start vboxweb-service
Restart Apache2 server, then browse to the host via IP or hostname followed by /phpvirtualbox
This is how to manage VirtualBox remotely.