VirtualBox VM Setup: Step-by-Step Guide
In this article
To create a VirtualBox virtual machine, install VirtualBox, download an OS ISO file, click “New” in the manager, allocate memory and disk space, then start the VM and run the OS installer. This guide walks through each step for Windows, macOS, or Linux hosts, including key settings and common pitfalls.
What Is VirtualBox and Why Use It?
VirtualBox is a free, open-source hypervisor that lets you run a complete operating system inside your current one. Each virtual machine (VM) gets its own virtual CPU, RAM, storage, and network adapter, so the guest OS behaves as if it were on a separate physical computer. People use it to test new OS versions, run software that doesn’t work on their host, isolate suspicious programs, or set up development environments.
It runs on Windows, macOS, Linux, and Solaris hosts, and supports a wide range of guest OSes including Windows, Linux, BSD, and others. Because it is free and actively maintained, it’s a common choice for students, developers, and IT professionals.
Before You Start: What You Need
- VirtualBox software – download the installer for your host OS from the official VirtualBox website.
- An OS installation ISO – for example, Ubuntu Desktop, Debian, Windows 10/11, or a lightweight Linux like Linux Mint. Many are free to download from official project websites.
- Sufficient disk space – at least 20–30 GB free for the VM’s virtual disk, plus room for the ISO file.
- RAM – at least 4 GB total, but 8 GB or more is recommended. You’ll allocate a portion to the VM.
- CPU virtualization enabled – in BIOS/UEFI, ensure Intel VT-x or AMD-V is turned on. Most modern PCs have it enabled by default.
Step-by-Step Setup Guide
- Install VirtualBox – Run the installer and follow the prompts. On Windows, you may need to accept device driver installation. On macOS, allow the installation in System Settings if prompted.
- Download an OS ISO – Go to the official site of the OS you want (e.g., ubuntu.com for Ubuntu). Download the ISO file to a folder you can find later.
- Open VirtualBox and click “New” – Enter a name for your VM (e.g., “Ubuntu Test”). VirtualBox will auto-detect the type and version based on the name, but you can adjust them.
- Set memory size – Use the slider. A good rule is to allocate about half of your host’s RAM, but not more than the green zone. For a modern desktop Linux, 4 GB (4096 MB) is a good start; for Windows 11, 8 GB is safer.
- Create a virtual hard disk – Choose “Create a virtual hard disk now.” Select VDI (VirtualBox Disk Image) as the file type, and “Dynamically allocated” for size. Set the size to 25–50 GB depending on the OS.
- Start the VM – Select the VM and click “Start.” A first-run wizard will ask for a startup disk. Browse to your ISO file and click “Start.”
- Install the OS – The VM will boot from the ISO. Follow the OS installer’s instructions. When asked about disk partitioning, choose “Erase disk and install” (this only affects the virtual disk, not your real computer).
- Install Guest Additions (recommended) – After the OS is installed, from the VM menu choose “Devices” → “Insert Guest Additions CD image.” Run the installer inside the VM. This improves screen resolution, clipboard sharing, and mouse integration.
Choosing the Right Settings
Not every OS needs the same resources. For a lightweight Linux like Xubuntu, 2 GB RAM and 20 GB disk is plenty. For Windows 11, you’ll need at least 4 GB RAM, 64 GB disk, and a 64-bit CPU. For macOS, VirtualBox does not officially support it as a guest due to license restrictions; use a real Mac or a different hypervisor.
Also consider the network mode. The default “NAT” gives the VM internet access but hides it from the local network. “Bridged” makes the VM appear as a separate device on your network, useful for servers or testing. For most beginners, NAT is fine.
Common Problems and Fixes
- “VT-x is not available” error – Enable virtualization in BIOS/UEFI (look for Intel VT-x, AMD-V, or SVM). Also disable Hyper-V on Windows if it’s on, as it conflicts with VirtualBox.
- VM starts but screen is black – Try increasing video memory in VM settings, or disable 3D acceleration. Also ensure the ISO is not corrupted.
- Mouse is captured and won’t release – Press the right Ctrl key (host key) to release. Installing Guest Additions fixes this permanently.
- No internet in the VM – Check network adapter settings. If using NAT, make sure “Cable connected” is checked.
- VM is very slow – Allocate more RAM or CPU cores, but don’t exceed half of your host’s resources. Also close heavy host applications.
Cost and Safety Considerations
VirtualBox itself is free. The guest OS may be free (Linux, BSD) or paid (Windows, macOS). You are responsible for licensing: running Windows in a VM requires a valid license. The VM is isolated, but not perfectly – malware can escape, so don’t use it for truly sensitive activities without extra precautions. Always download ISOs from official sources to avoid tampered files.
Alternatives to VirtualBox
Other free hypervisors include VMware Workstation Player (free for personal use), Hyper-V (built into Windows Pro), and QEMU/KVM (Linux). For cloud-based VMs, consider AWS or Azure. VirtualBox is the most beginner-friendly because of its GUI and cross-platform support, but Hyper-V is more integrated on Windows, and KVM offers better performance on Linux servers.
Frequently Asked Questions
How much RAM should I give my VM?
For a 64-bit Linux desktop, 4 GB is comfortable. For Windows 10/11, use at least 8 GB if possible. Never allocate more than half of your host’s total RAM, or your computer will become sluggish.
Can I use a USB drive in the VM?
Yes. With the VM running, go to Devices → USB and select your USB device. Install Guest Additions and the Extension Pack (from VirtualBox’s official site) for best compatibility.
How do I share files between host and guest?
Install Guest Additions, then set up a shared folder in VM settings (Shared Folders). You can also use drag-and-drop if enabled, or simply use a cloud service.
Why is my VM not starting after I updated VirtualBox?
After a major update, Guest Additions inside the VM may be outdated. Boot the VM, reinstall Guest Additions from the CD image, and reboot. Also ensure the VM’s settings are still valid (e.g., CPU count).
Is it safe to run Windows in a VM?
Yes, it’s generally safe. The VM is sandboxed, but no isolation is perfect. Keep the guest OS updated, and avoid using the VM for online banking if you’re concerned about security.