VirtualBox is free for personal use virtualization software. This article describe how to install its commercial version (with USB support).

This howto is tested on:

  • Ubuntu 19.10 Eoan Ermine

This howto is tested with these versions of the software:

  • 6.1

Installation

Install the software with:

arch="$(command dpkg --print-architecture)"
distName="$(command lsb_release -cs)"
version="$(command wget --quiet --output-document=- 'http://download.virtualbox.org/virtualbox/debian/pool/contrib/v/' \
  | command awk '/virtualbox-/ {matchingLine=$0} END {match(matchingLine,"virtualbox-([^/]*)/",version) ; print version[1] }' )"
sudo -v && {
  sudo tee '/etc/apt/sources.list.d/virtualbox.list' \
<<< "# VirtualBox repository
deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian ${distName} contrib non-free"
  command wget --quiet --output-document=- \
    'http://download.virtualbox.org/virtualbox/debian/oracle_vbox_2016.asc' \
   | sudo apt-key add -
  sudo apt 'update'
  sudo apt install "virtualbox-${version}" 'dkms'
  sudo adduser "${USER}" 'vboxusers'
}

Step by step installation

Detect the system’s architecture:

arch="$(command dpkg --print-architecture)"

Detect the distribution name:

distName="$(command lsb_release -cs)"

Detect the last version of the software:

version="$(command wget --quiet --output-document=- 'http://download.virtualbox.org/virtualbox/debian/pool/contrib/v/' \
  | command awk '/virtualbox-/ {matchingLine=$0} END {match(matchingLine,"virtualbox-([^/]*)/",version) ; print version[1] }' )"

Set up the software repository:

sudo tee "/etc/apt/sources.list.d/virtualbox.list" \
<<< "# VirtualBox repository
deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian ${distName} contrib non-free"

Download the repository signing key:

command wget --quiet --output-document='-' \
    'http://download.virtualbox.org/virtualbox/debian/oracle_vbox_2016.asc' \
  | sudo apt-key add -

Update the available packages list:

sudo apt-get update

Install the software:

sudo apt-get install "virtualbox-${version}" "dkms"

Add the current user to the “vboxusers” group to allow access to USB peripherals from the virtual machines:

sudo adduser "${USER}" 'vboxusers'

Immediate use

In order to use the software without restarting the system first, run this commands:

sudo -v && {
  sudo systemctl restart 'udev'
  sudo modprobe 'vboxdrv'
  sudo -u "${USER}" VirtualBox
}

Troubleshooting

If the current user is not allowed to use VirtualBox virtual machines, add it to the “vboxusers” group:

sudo adduser "${USER}" 'vboxusers'

Restart the system to apply the changes.

Thanks

Categories: Software

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

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