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