Installation and Configuration
- Log into the Ubuntu Server host
- Run the following commands
# update software repositories
sudo apt update
# install available software updates
sudo apt upgrade -y
# install virtualbox
sudo apt install virtualbox -y
# verify virtualbox installed by outputting the version
vboxmanage -version
# install virtualbox extension pack
sudo apt install virtualbox-ext-pack -y
# disable default vboxweb service
sudo systemctl disable vboxweb
# create vboxadmin user and set a password
sudo useradd vboxadmin
# set the vboxadmin password
sudo passwd vboxadmin
# add vboxadmin to the vboxuser group
sudo usermod -aG vboxusers vboxadmin
# create vboxadmin home directory
sudo mkdir /home/vboxadmin -p
# make vboxadmin the owner of the home directory
sudo chown -R vboxadmin /home/vboxadmin
# edit the default virtualbox configuration
sudo nano /etc/default/virtualbox - Add the following line to the bottom of the file, changing the username if necessary
VBOXWEB_USER=vboxadmin
VBOXWEB_HOST=127.0.0.1 - Press CTRL+O, Enter, CTRL+X to write the changes
- Continue with the following commands, changing the username if necessary
# create vboxweb.sh
sudo nano /home/vboxadmin/vboxweb.sh - Paste the following into vboxweb.sh
#!/bin/bash
/usr/bin/vboxwebsrv -H 127.0.0.1 > /dev/null 2>&1 - Press CTRL+O, Enter, CTRL+X to write the changes
- Continue with the following commands, changing the username if necessary
# make vboxweb.sh executable
sudo chmod +x /home/vboxadmin/vboxweb.sh
# create phpvirtualbox.service
sudo nano /etc/systemd/system/phpvirtualbox.service - Paste the following service configuration, changing the username if necessary
[Unit]
Description=VirtualBox Web Service
After=network.target[Service]
Type=simple
RemainAfterExit=yes
User=vboxadmin
Group=vboxusers
WorkingDirectory=/home/vboxadmin
ExecStart=/home/vboxadmin/vboxweb.sh
Restart=on-failure[Install]
WantedBy=default.target - Continue with the following commands
# enable phpvirtualbox.service
sudo systemctl enable phpvirtualbox.service
# start phpvirtualbox.service
sudo systemctl start phpvirtualbox.service
# install apache2 web server and php
sudo apt install apache2 php libapache2-mod-php php-curl php-intl php-json php-gd php-mbstring php-xml php-zip php-soap -y
# empty the apache2 web root
sudo rm /var/www/html/*
# install git
sudo apt install git -y
# clone phpVirtualBox git repository
sudo git clone https://github.com/phpvirtualbox/phpvirtualbox.git /var/www/html
# copy phpVirtualBox example config
sudo cp /var/www/html/config.php-example /var/www/html/config.php
# edit the config file
sudo nano /var/www/html/config.php - Update the $username and $password variables to vboxadmin and the password set for the vboxadmin user
- Press CTRL+O, Enter, CTRL+X to write the changes to config.php
- Open a web browser from another machine and navigate to https://DNSorIP of the VirtualBox host
- Log into phpVirtualBox with username admin and password admin
Creating a Test VM
- Run the following command on the VirtualBox host to download the TinyCore Linux .iso
sudo wget -O /home/vboxadmin/TinyCore-12.0.iso http://tinycorelinux.net/12.x/x86/release/TinyCore-12.0.iso
- In the phpVirtualBox web UI, click New
- Set the Name to TinyCore Linux, Type to Linux and Version to Other Linux (32-bit) > Click Next
- Leave the memory at 256 MB > Click Next
- Select Do not add a virtual hard disk > Click Create
- Click Continue to confirm creating the VM with no virtual hard disk
- Right click the TinyCore Linux VM > Settings...
- Select Storage from the left navigation menu
- Click on the empty optical drive
- Click the choose disk image dropdown > Choose a virtual disk file...
- Navigate to /home/vboxadmin/TinyCore-12.0.iso and select it
- Click OK to all open dialog windows
- Right click the TinyCore Linux VM > Start
- If everything is working as expected TinyCore Linux should be booting to the live environment
- Look at the Display details to find the remote port (starts at 9000 by default)
- To view the VM directly, remote desktop to the VirtualBox host IP:9000