This guide covers the installation of VirtualBox 7.0 on Ubuntu 22.04 Server with a Docker-based web control panel. By the end, you will have a headless virtualization host accessible through a browser interface, suitable for running operating systems that require full system control without the resource overhead of a desktop environment.
Why VirtualBox for Server Virtualization
VirtualBox provides Type 2 hypervisor functionality when container isolation is insufficient but dedicated hardware is impractical. The combination of VirtualBox’s command line tools and phpVirtualBox creates a web-accessible control panel for managing virtual machines on headless servers. This approach works for development environments, legacy application hosting, or any scenario where the guest operating system needs complete control of its environment.
Prerequisites and Environment
This guide was tested on Ubuntu 22.04 Server in October 2023 with VirtualBox 7.0. Current versions of VirtualBox may differ. Check the official repository for the latest stable version number and adjust package names accordingly.
You need sudo or root access to the server. A basic Docker environment is required for the web control panel. The host machine must have hardware virtualization support (Intel VT-x or AMD-V) enabled in the BIOS. Without this, only 32-bit guest systems will function properly.
Implementation Steps
Step 1: Add the VirtualBox Repository
Import the Oracle VirtualBox repository signing key:
sudo wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpgAdd the VirtualBox repository to your system’s package sources:
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.listUpdate the package cache to include the new repository:
sudo apt updateStep 2: Install VirtualBox
Install VirtualBox 7.0 from the repository:
sudo apt install virtualbox-7.0The package name is case-sensitive. Note that the source material uses incorrect capitalization (VirtualBox-7.0). The correct package name is all lowercase.
Download the VirtualBox Extension Pack, which provides USB 2.0 and USB 3.0 support, VirtualBox Remote Desktop Protocol (VRDP), and other features:
ver=$(vboxmanage -v | cut -dr -f1)
cd
wget https://download.virtualbox.org/virtualbox/$ver/Oracle_VM_VirtualBox_Extension_Pack-$ver.vbox-extpackInstall the extension pack:
sudo vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-$ver.vbox-extpackAccept the license agreement when prompted.
Step 3: Create a VirtualBox System User
Create a dedicated system user to run VirtualBox services:
sudo useradd -m -d /home/vbox -g vboxusers -s /bin/false vbox
sudo passwd vboxSet a strong password when prompted. This account will be used by the web service to authenticate and manage virtual machines.
Step 4: Configure the VirtualBox Web Service
Create the web service configuration file:
sudo nano /etc/default/virtualboxAdd the following configuration, replacing the placeholder values with your actual settings:
VBOXWEB_USER=vbox
VBOXWEB_PASSWD=your_vbox_password
VBOXWEB_HOST=your_server_ip
VBOXWEB_TIMEOUT=0The VBOXWEB_HOST value should be the IP address of the server. The VBOXWEB_TIMEOUT value of 0 disables session timeout, which is appropriate for automated management but should be reconsidered in environments where idle sessions pose a security risk.
Restart the VirtualBox web service:
sudo systemctl restart vboxweb-serviceVerify that the service is running:
sudo systemctl status vboxweb-serviceYou should see active (running) in the output. The service listens on port 18083 by default. Confirm this with netstat:
netstat -tulpn | grep 18083Expected output shows vboxwebsrv listening on the configured host IP:
tcp 0 0 192.168.1.100:18083 0.0.0.0:* LISTEN 8343/vboxwebsrvStep 5: Deploy the phpVirtualBox Web Interface
Install docker-compose if not already present:
sudo apt install docker-composeCreate a directory for Docker configurations:
sudo mkdir -p /opt/docker
cd /opt/dockerCreate a docker-compose.yml file:
sudo nano docker-compose.ymlAdd the following configuration, replacing placeholder values with your server details:
version: '3'
services:
vbox_http:
container_name: vbox_http
image: jazzdd/phpvirtualbox
ports:
- "8081:80"
environment:
SRV1_HOSTPORT: "your_server_ip:18083"
SRV1_NAME: "your_server_name"
SRV1_USER: "vbox"
SRV1_PW: "your_vbox_password"
CONF_browserRestrictFolders: "/home,/usr/lib/virtualbox,"
restart: unless-stoppedStart the container environments:
docker-compose up -dThe web interface will be available at http://your_server_ip:8081. The default credentials are admin/admin. Change this password immediately through the File menu after first login.
Step 6: Create and Configure a Virtual Machine
Before creating virtual machines through the web interface, prepare storage locations with appropriate permissions:
sudo mkdir -p /opt/virtualbox
sudo chown vbox:vboxusers /opt/virtualbox
sudo chmod 775 /opt/virtualboxThrough the phpVirtualBox web interface, create a new virtual machine. Specify the machine folder path as /opt/virtualbox or a subdirectory within it. Store virtual disk files on SSD storage for acceptable performance. Mechanical hard drives will result in poor guest operating system responsiveness.
Configure the virtual machine’s display settings to enable VRDP (VirtualBox Remote Desktop Protocol). Each virtual machine will be assigned a sequential port number starting from the base VRDE port (default 3389). Access the console using an RDP client pointed at your_server_ip:port_number.
The VRDP console provides full keyboard and mouse control before guest operating system remote access services are configured. This is necessary during OS installation and initial setup. Note that VRDP exposes the virtual machine console to anyone who can reach the port. Use firewall rules to restrict access or disable VRDP after initial configuration is complete.
Troubleshooting and Validation
If the web interface fails to connect to the VirtualBox web service, verify that vboxweb-service is running and listening on the expected port. Check the Docker container logs:
docker logs vbox_httpConfirm that the credentials in docker-compose.yml match those in /etc/default/virtualbox.
If virtual machines fail to start, check that hardware virtualization is enabled in the host BIOS. Run the following to verify VT-x or AMD-V support:
egrep -c '(vmx|svm)' /proc/cpuinfoA result of 0 indicates virtualization is not available or not enabled. A result greater than 0 confirms support.
For detailed VirtualBox configuration and troubleshooting:
AI assistance is used on this site for language, formatting, and turning research into a consistent template. It is not used to perform the underlying research or verify technical claims. Every command, configuration, and step in this post is tested by hand before publication.