Oracle virtual box is a cross-platform virtualization application. It installs on existing Intel or AMD-based computers, whether they are running Windows, Mac, Linux or Solaris operating systems. You can choose to jump through several urls to find and download the right version or you can use the easier way. I’m going to explain the latter in this blog. For this post, you need to have Chocolatey installed on the machine. You can check here on how to do so.
Once you have done this, open a PowerShell prompt and run below one line command:
choco install virtualbox
This will ask you to confirm, say yes and then it will install the virtual box for you. Below is the sample output from my machine:
PS C:\Windows\system32> choco install virtualbox Chocolatey v0.10.3 Installing the following packages: virtualbox By installing you accept licenses for the packages. chocolatey-core.extension v1.0.4 [Approved] chocolatey-core.extension package files install completed. Performing other installation steps. Installed/updated chocolatey-core extensions. The install of chocolatey-core.extension was successful. Software installed to 'C:\ProgramData\chocolatey\extensions\chocolatey-core' virtualbox v188.8.131.5261207 [Approved] virtualbox package files install completed. Performing other installation steps. The package virtualbox wants to run 'chocolateyInstall.ps1'. Note: If you don't run this script, the installation will fail. Note: To confirm automatically next time, use '-y' or consider setting 'allowGlobalConfirmation'. Run 'choco feature -h' for more details. Do you want to run the script?([Y]es/[N]o/[P]rint): y Downloading virtualbox 64 bit from 'http://download.virtualbox.org/virtualbox/5.1.10/VirtualBox-5.1.10-112026-Win.exe' Progress: 100% - Completed download of C:\Users\Admin\AppData\Local\Temp\chocolatey\virtualbox\184.108.40.20661207\VirtualBox-5.1.10-112026-Win.exe (117.32 MB). Download of VirtualBox-5.1.10-112026-Win.exe (117.32 MB) completed. Hashes match. Installing virtualbox... virtualbox has been installed. Installing extension pack Downloading virtualbox-extensionpack 64 bit from 'http://download.virtualbox.org/virtualbox/5.1.10/Oracle_VM_VirtualBox_Extension_Pack-5.1.10.vbox-extpack' WARNING: C:\Users\Admin\AppData\Local\Temp\chocolatey\virtualbox\220.127.116.1161207\Oracle_VM_VirtualBox_Extension_Pack-5.1.10.vbox-extpack is of content type text/plain Progress: 100% - Completed download of C:\Users\Admin\AppData\Local\Temp\chocolatey\virtualbox\18.104.22.16861207\Oracle_VM_VirtualBox_Extension_Pack-5.1.10.vbox-extpack (18.57 MB). Download of Oracle_VM_VirtualBox_Extension_Pack-5.1.10.vbox-extpack (18.57 MB) completed. Hashes match. C:\Users\Admin\AppData\Local\Temp\chocolatey\virtualbox\22.214.171.12461207\Oracle_VM_VirtualBox_Extension_Pack-5.1.10.vbox-extpack 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Successfully installed "Oracle VM VirtualBox Extension Pack". Adding to PATH if needed PATH environment variable does not have C:\Program Files\Oracle\VirtualBox in it. Adding... virtualbox installed to 'C:\Program Files\Oracle\VirtualBox' virtualbox registered as vbox Only an exit code of non-zero will fail the package by default. Set `--failonstderr` if you want error messages to also fail a script. See `choco -h` for details. Environment Vars (like PATH) have changed. Close/reopen your shell to see the changes (or in powershell/cmd.exe just type `refreshenv`). The install of virtualbox was successful. Software installed as 'EXE', install location is likely default. Chocolatey installed 2/2 packages. 0 packages failed. See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Those who don’t know what package management is, it’s a new feature in PowerShell v5 and also runs on older version of PowerShell. More info here.
For more information on this package, check here.