Software & OS

Oracle VM VirtualBox: Install It and Create Your First VM

Oracle VM VirtualBox is a free program that runs a second operating system in a window on your computer. To get started, install VirtualBox, open VirtualBox Manager, run the Create VM wizard with an ISO file of the system you want, and start the new machine.

The current Oracle manual shortens the product name to "Oracle VirtualBox", and this article uses both names for the same program. Wizard labels below are taken from Oracle's 7.2 documentation. Screens in other versions can differ a little.

What you need before installing Oracle VM VirtualBox

VirtualBox needs an operating system already installed on the host. According to the manual's introduction, it runs on Windows, macOS, Linux and Oracle Solaris hosts, on x86_64 (Intel or AMD) and Arm64 hardware. On a Mac, Intel hosts need Intel hardware and Arm64 hosts need Apple silicon.

You also need three practical things:

  • An ISO file of the operating system you want to run inside the VM, for example a Linux distribution's installer image. The wizard asks for it.
  • Free disk space for the virtual hard disk and for the VM folder, especially if you plan to use snapshots. Oracle says to make sure the VM folder location has enough free space for that reason.
  • Hardware virtualization enabled in the firmware (Intel VT-x or AMD-V). If it is off, see how to enable hardware virtualization in the BIOS before you continue.

Install VirtualBox on Windows

Download the Windows installer from the VirtualBox website and double-click it. The installer lets you choose the install location and which components to add, and it creates a Start menu group.

The manual lists these optional components:

  • USB support
  • Networking, which provides bridged networking
  • Python support, which needs Python 3 installed

The defaults are fine for a first VM. The manual warns that you "may see warnings about unsigned drivers" during setup. Continue past them, because VirtualBox might not work correctly without those drivers.

For scripted installs, the manual describes extracting the MSI and installing it with msiexec:

VirtualBox-<version>-<revision>-Win.exe -extract
msiexec /i <extracted-file>.msi

Replace the placeholders with the real file names. The manual says unattended installations use the standard MSI support, with public properties that control things such as the desktop shortcut and whether VirtualBox starts after installation.

Install VirtualBox on Linux

On Linux the installer builds kernel modules (vboxdrv, vboxnetflt and vboxnetadp) on your machine. That is why the manual says the running kernel and the kernel header files must be updated to matching versions. If they don't match, the build fails and VMs will not start.

Three more details from the manual:

  • Debian and Ubuntu packages install with dpkg. The generic VirtualBox.run installer runs as root with the install argument.
  • To give a VM access to USB devices, add your user to the vboxusers group.
  • On systems with UEFI Secure Boot, the kernel modules may need to be signed before they will load.
  • The graphical interface needs Qt 6.5.3 or later.

Create your first VM in VirtualBox Manager

Open VirtualBox Manager and start the Create VM wizard. The wizard applies the correct settings for the operating system you select, as the manual notes, so you rarely need to touch advanced options. It has four pages you will fill in.

Page 1: Name and Operating System

  • Name: shown in the Machines tool and also used for the VM's files on disk, so pick something you will recognise.
  • Folder: the VM Folder, where VM files are stored.
  • ISO Image: the installer image for the operating system. If the image holds more than one edition, choose the one you want.
  • OS type and version: VirtualBox fills these in if it can detect the system in the ISO, for example "Oracle Linux 8.x (64-bit)". Choose "Other" only for something unusual that is not listed.
  • Install OS Using Unattended Installation: on by default. Oracle says that if you prefer to install the operating system manually, you deselect it. The ISO is then attached to the new VM and you run the installer yourself inside the VM window.

Page 2: Unattended Guest OS Install (only if unattended is on)

Here you set the User Name and Password of a default user. On Windows guests that user is an administrator. On Linux guests the root user is created too, with the same password. Windows guests also take a Product Key. The Host Name defaults to the VM name.

The Install Guest Additions option installs the Guest Additions after the operating system, from the ISO that ships with your VirtualBox installation. Install in Background creates the VM without showing a window.

Page 3: Hardware

VirtualBox suggests a default Base Memory for the operating system you chose. Oracle's advice is to not specify more than you can spare, while still allocating enough for the guest and its applications. A guest may need at least 1 or 2 GB to install and boot. For Processors, the manual says not to assign more than half of the host's total processor threads. Use EFI boots the guest with Extended Firmware Interface instead of the legacy firmware.

A worked example: on a host with 16 GB of memory and 8 processor threads, giving the VM 4 GB and 4 processors leaves half the threads and 12 GB for the host. Both numbers can be changed later from the VM's settings, though not below what the guest needs to boot.

Page 4: Virtual Hard Disk

Choose the Disk Size. The wizard creates a dynamically allocated disk image in the VM folder, which means the file starts small and grows as the guest writes data, up to the size you set. For reference, the manual's command-line example creates a disk of 32768 MB, which is 32 GB, with --size 32768.

Finish the wizard. The new machine appears in the Machines tool.

Start the VM and install the operating system

Select the machine and start it. With unattended installation on, the install runs by itself on first start. With it off, the VM boots from the attached ISO and you click through the guest's own installer.

One caveat from the manual: if the virtual hard disk already contains a bootable operating system, the unattended installation exits. In that case press F12 during the virtual BIOS splash screen to change the boot order.

You can also start a VM without opening VirtualBox Manager. The manual's example starts a VM in headless mode, with no window:

VBoxManage startvm "My VM" --type headless

Use the name you gave the VM. Because a headless VM has no window, you reach it over the network or by stopping it from VirtualBox Manager.

Install the Guest Additions

The Guest Additions are software installed inside the guest once its operating system is running. They improve performance and add host integration such as shared folders and clipboard sharing. Oracle's manual states: "Clipboard sharing requires the Oracle VirtualBox Guest Additions." If you ticked Install Guest Additions in the wizard, this happens automatically after the install. The manual says automatic installation is available only for some guests, so on others you install them by hand from inside the VM.

If the VM won't start or is slow

First check that VT-x or AMD-V is enabled in the firmware, as described above. If only 32-bit guests are offered, that setting is the usual reason. Then check that you have not given the VM more memory or processors than the host can spare, since the manual advises against it. On Windows, VirtualBox shares the machine with other virtualization features, so Hyper-V being active can change how your VMs run. For a comparison of full VMs with containers, see Docker vs virtual machine.

Frequently asked questions

Is Oracle VM VirtualBox free?
The VirtualBox base package is open source under the GPLv3, so installing it and creating VMs costs nothing. The separate Extension Pack has different licence terms (personal and educational use only), and you do not need it for the steps in this article. Check Oracle's licensing FAQ before using the Extension Pack at work.
How much memory and disk space should I give a new VM?
VirtualBox suggests a default Base Memory for the operating system you pick. Oracle's manual says a guest may need at least 1 or 2 GB of memory to install and boot, and warns not to give the VM more than you can spare. The disk image is dynamically allocated, so the size you choose is a ceiling that the file grows towards, not space taken immediately.
Do I need the Guest Additions?
You can run a VM without them. They are software installed inside the guest after the operating system is running, and they add features such as shared folders and clipboard sharing. Oracle's manual states that clipboard sharing requires the Guest Additions.
Why does my VM only offer a 32-bit operating system or fail to start?
A common cause is that hardware virtualization (Intel VT-x or AMD-V) is switched off in the computer's firmware settings. Turn it on there, restart, and try again. On Windows, other virtualization software such as Hyper-V can also affect how VMs run.

Sources