Install Virtualbox Extension Commandline

$(vboxmanage -v)

Gives version like this  5.1.4r110228

We need split above version with “r” and use those to generate our required filename

Then get the file from download. virtualbox. org/virtualbox/5.1.4/

Installing is just issuing this command

sudo VBoxManage extpack install <YOUR FILE> –replace

version=$(vboxmanage -v)
echo $version
var1=$(echo $version | cut -d ‘r’ -f 1)
echo $var1
var2=$(echo $version | cut -d ‘r’ -f 2)
echo $var2
echo $file
wget ***: download. virtualbox. org/virtualbox/$var1/$file -O /tmp/$file
#sudo VBoxManage extpack uninstall “Oracle VM VirtualBox Extension Pack”
sudo VBoxManage extpack install /tmp/$file –replace