Install Virtualbox 5.2/6.1 on Ubuntu 16 headless mode

Install Prerequisites

Before installing VirtualBox 5.2/6.1, please install these packages below if your systems don’t already have them installed….

sudo apt update
sudo apt-get install gcc make linux-headers-$(uname -r) dkms

Add VirtualBox Repository

If you want to always get the latest versions of VirtualBox when they become available, you’ll want to add its software repository to Ubuntu…

Run the commands below to add the repository key to your system…

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -

After adding the repository key above, run the commands below to add VirtualBox package repository.

sudo add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib"

After that, run the commands below to update Ubuntu repositories.

Installing VirtualBox

At this point, the Ubuntu system should be ready to install the latest version of VirtualBox. First you may want to remove the previous 6.0 version if you’re still running it… to do that, run the commands below:

sudo apt remove virtualbox virtualbox-6.1

Finally, run the commands below to install the latest 6.1 (major) version of the software.

Instal 6.1

sudo apt update
sudo apt-get install virtualbox-6.1

Download and install extpack of 6.1

wget https://download.virtualbox.org/virtualbox/6.1.22/Oracle_VM_VirtualBox_Extension_Pack-6.1.22.vbox-extpack
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.22.vbox-extpack

*Use VBoxManage command as root user.

Install 5.2

You may wish to deploy a backward edition for certain compatibility issue-

sudo apt update
sudo apt-get install virtualbox-5.2

Download and install extpack of 5.2

wget https://download.virtualbox.org/virtualbox/5.2.44/Oracle_VM_VirtualBox_Extension_Pack-5.2.44.vbox-extpack
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.2.44.vbox-extpack

*Use VBoxManage command as root user.

Installing phpvirtualbox First create a system user called vbox and add it to the vboxusers group:

useradd -m vbox -G vboxusers

Create a password for the vbox user:

passwd vbox

Create the file /etc/default/virtualbox and put the line

VBOXWEB_USER=vbox

Now, run the following command to check if virtualbox kernel modules are loaded or not.

sudo systemctl status vboxdrv

Or

sudo /etc/init.d/vboxdrv status

Sample output:

vboxdrv.service - VirtualBox Linux kernel module
Loaded: loaded (/usr/lib/virtualbox/vboxdrv.sh; enabled; vendor preset: enabled)
Active: active (exited) since Thu 2015-11-26 16:38:30 IST; 42s ago

Nov 26 16:38:29 server systemd[1]: Starting VirtualBox Linux kernel module...
Nov 26 16:38:30 server systemd[1]: Started VirtualBox Linux kernel module.
Nov 26 16:38:30 server vboxdrv.sh[15008]: Starting VirtualBox kernel modules....
Hint: Some lines were ellipsized, use -l to show in full.

If it, not loaded, run the following command to load them:

sudo /etc/init.d/vboxdrv setup

For Ubuntu 16 use the following packs:

apt-get install php libapache2-mod-php php-mcrypt php-mysql  php-xml php-soap unzip

Install PHPVirtualBox for 5.2 (as of this content writing there was no updated edition available after 5.2)

wget https://github.com/phpvirtualbox/phpvirtualbox/archive/refs/tags/5.2-1.zip
unzip 5.2-1.zip

use mv command to /var/www/html/<virtualbox_folder>

cd /var/www/html/<virtualbox_folder>
cp config.php-sample config.php
nano config.php

Now edit the following 2 lines-

var $password = 'your_vbox_user_password';
var $vrdeaddress = 'your_virtualbox_IP';

Now login to web browser-

http://<your_virtualbox_ip>/<virtualbox_folder>

Ref:

VBoxHeadless Running Virtual Machines With VirtualBox On A Headless Debian/ubuntu Server

VirtualBox Major Update 6.1 Released — Install | Upgrade on Ubuntu 18.04

Share

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.