QuidsUp - Scripts - Virtualbox Installer
VirtualBox Guest Additions Installer

Script to install VirtualBox in an Ubuntu based system, and configure user privileges.

Optional: Download the VirtualBox Extension Pack from: VirtualBox Downloads
Open the Extension Pack via your file manager in order to install it with VirtualBox.

Usage:
wget quidsup.net/sh/installvbox.sh
bash installvbox.sh
Script:
#!/bin/bash
#Title :        installvbox.sh
#Description :  This script will add the Oracle Repository for VirtualBox,
#                install the application, and then add the current user to vboxusers group
#Author :       QuidsUp
#Date :         2019-06-23
#Version :      0.4
#Usage :        bash installvbox.sh
#Version History:
#0.1  2014-10-14  Created
#0.2  2015-03-27  Added header information
#0.3  2015-03-28  Swapped su for tee command
#0.4  2019-06-23  Added additional key and forced 64 bit architecture
#==============================================================================

echo  "[arch=amd64] deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib non-free #Virtualbox" | sudo tee /etc/apt/sources.list.d/virtualbox.list
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -

sudo apt-get update
sudo apt-get install virtualbox-6.2
if [ "`grep vboxusers /etc/group|grep $USER`" == "" ] ; then sudo usermod -G vboxusers -a $USER ; fi