9 | | Cleaning: For Ubuntu/Mint and derivatives i recommend using the script described in this post (backup your configurations and VMs before running it): [https://askubuntu.com/questions/1029198/skipping-acquire-of-configured-file-contrib-binary-i386-packages-as-repository/1029865#1029865] |
10 | | |
11 | | This script cleans previous installations (to avoid conflicts) and install Virtualbox to the latest version + Guest Additions |
12 | | |
13 | | {{{ |
14 | | sudo chmod +x VboxInstall.sh && sudo ./VboxInstall.sh |
15 | | }}} |
16 | | |
17 | | Bash Content: |
18 | | {{{ |
19 | | #!/bin/bash |
20 | | while true; do |
21 | | read -p "Do you want to install Virtualbox? (y/n)" answer |
22 | | case $answer in |
23 | | [Yy]* ) |
24 | | # execute command yes |
25 | | echo "Virtualbox Pack setup..." |
26 | | echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" | tee /etc/apt/sources.list.d/virtualbox.list |
27 | | wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | apt-key add - |
28 | | vboxmanage list runningvms | sed -r 's/.*\{(.*)\}/\1/' | xargs -L1 -I {} VBoxManage controlvm {} savestate |
29 | | killall vboxwebsrv && pkill virtualbox |
30 | | systemctl stop vboxweb-service.service |
31 | | export VBOX_VER=`VBoxManage --version|awk -Fr '{print $1}'` |
32 | | VBoxManage extpack uninstall "Oracle VM VirtualBox Extension Pack" |
33 | | apt -y autoremove --purge virtualbox* |
34 | | rm -rf /etc/vbox /opt/VirtualBox /usr/lib/virtualbox ~/.config/VirtualBox |
35 | | apt update && apt autoclean && apt clean && apt autoremove && apt-get -y dist-upgrade && apt -y --fix-broken install |
36 | | apt -y install virtualbox-6.0 bridge-utils |
37 | | dpkg --configure -a && apt-get -f -y install |
38 | | wget -c http://download.virtualbox.org/virtualbox/$VBOX_VER/Oracle_VM_VirtualBox_Extension_Pack-$VBOX_VER.vbox-extpack |
39 | | VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-$VBOX_VER.vbox-extpack |
40 | | usermod -a -G vboxusers $USER |
41 | | systemctl enable vboxweb-service && systemctl start vboxweb-service |
42 | | update-grub |
43 | | vboxconfig |
44 | | echo "Done" |
45 | | break;; |
46 | | [Nn]* ) |
47 | | # execute command no |
48 | | break;; |
49 | | * ) echo; echo "Select: YES (y) or NO (n)";; |
50 | | esac |
51 | | done |
52 | | }}} |
53 | | |