This guide assumes you’re running Debian (10), this guide will use Virtualbox 5.2. If you’re running version 6, of Virtualbox, please use the VBOX6.x tag of the jazzdd/phpvirtualbox Docker image.

Look here for debian 11: https://linuxopsys.com/topics/install-virtualbox-on-debian

Install Virtualbox on the host

As root run the following commands.

apt install virtualbox-5.2

Edit or create _/etc/default/virtualbox _and make sure you set the username and host settings (update it with the information for your setup) e.g. as below:

VBOXWEB_USER=vbox 
VBOXWEB_HOST=0.0.0.0

And start the Virtualbox webservice as follows:

vboxwebsrv -H 0.0.0.0

Warnings:

  • You expose Virtualbox to the network in this manner, if you use 0.0.0.0 a connection on any interface of the server will have access to the API. If one of these interfaces have traffic which is potentially untrusted, use some firewall rules to block this access.
  • vboxwebsrv -H 0.0.0.0 runs directly as your user, so if you logout of your session it will close. Potential fixes for this include running it inside of tmux, or making service/deamon definition.

Kubernetes

phpVirtualbox is available here: https://github.com/phpvirtualbox/phpvirtualbox

The containerized version is available here: https://github.com/jazzdd86/phpVirtualbox

The Docker repo is here: https://hub.docker.com/r/jazzdd/phpvirtualbox

Kubernetes deployment example:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: phpvirtualbox
  labels:
    app: phpvirtualbox
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  selector:
    matchLabels:
      app: phpvirtualbox
  template:
    metadata:
      labels:
        app: phpvirtualbox
    spec:
      containers:
      - name: phpvirtualbox
        image: jazzdd/phpvirtualbox
        env:
        - name: SRV1_HOSTPORT
          value: "192.168.0.10:18083"
          # Please fill in the IP address of the server here that makes the API accessible.

        - name: SRV1_NAME
          value: "Server_name_here"
          # You can name the server here if you wanna.

        - name: SRV1_USER
          value: "vbox"
          # Username to login for the endpoint.

        - name: SRV1_PW
          value: "Fill in the password here"
          # Password for the endpoint.

        - name: CONF_noAuth
          value: "false"
        - name: SRV1_CONF_browserRestrictFolders
          value: "/paths/to/restrict/separated-with-a-comma/and/ending-with-a-comma,"
          # Limit the location that can be browsed for ISO/IMG images, or the hard disk location.
        - name: CONF_browserRestrictFolders
          value: "/paths/to/restrict/separated-with-a-comma/and/ending-with-a-comma,"
          # Limit the location that can be browsed for ISO/IMG images, or the hard disk location.
        imagePullPolicy: Always
        ports:
        - containerPort: 80
        resources:
          requests:
            memory: "16Mi"
          limits:
            memory: "512Mi"

Don’t forget to use a service definition to make this container accessible. This service runs on the default HTTP port.

Enabling RDP (Virtualbox extension pack)

To be able to use see, type, and mouse in your virtual machine, phpVirtualbox allows you to use a Flash-based viewer. But Flash has been unsupported for years by now… You can use just use RDP to connect to the machine. To do this the Virtualbox extension pack needs to be downloaded:

wget https://download.virtualbox.org/virtualbox/6.1.40/Oracle_VM_VirtualBox_Extension_Pack-6.1.40.vbox-extpack
--2022-12-31 20:57:19--  https://download.virtualbox.org/virtualbox/6.1.40/Oracle_VM_VirtualBox_Extension_Pack-6.1.40.vbox-extpack
Resolving download.virtualbox.org (download.virtualbox.org)... 104.85.4.85
Connecting to download.virtualbox.org (download.virtualbox.org)|104.85.4.85|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11233264 (11M) [text/plain]
Saving to: ‘Oracle_VM_VirtualBox_Extension_Pack-6.1.40.vbox-extpack’

Oracle_VM_VirtualBox_Extension_Pack-6.1.40.vbox-extp 100%[===============================>]  10.71M  26.8MB/s    in 0.4s

2022-12-31 20:57:20 (26.8 MB/s) - ‘Oracle_VM_VirtualBox_Extension_Pack-6.1.40.vbox-extpack’ saved [11233264/11233264]

And then installed

sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.40.vbox-extpack 
VirtualBox Extension Pack Personal Use and Evaluation License (PUEL)

License version 11, 21 May 2020

...
Skipping the legal wall of text.
...

Do you agree to these license terms and conditions (y/n)? y

License accepted. For batch installation add
--accept-license=33d7284dc4a0ece381196fda3cfe2ed0e1e8e7ed7f27b9a9ebc4ee22e24bd23c
to the VBoxManage command line.

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Successfully installed "Oracle VM VirtualBox Extension Pack".

And you should be able to use RDP too!