Overview
VirtualBox is a free, cross-platform virtualization tool that runs on Windows, macOS, and Linux hosts. It's ideal for testing Linux distributions without affecting your main system.
What You Need
- VirtualBox installed from virtualbox.org
- Extension Pack installed (for USB 3.0 and better performance)
- Linux ISO file downloaded
- At least 8GB RAM on host (16GB recommended)
Create a New Virtual Machine
Step 1: Click "New"
- Name your VM (e.g., "Ubuntu 24.04")
- Folder location can stay default
- Click Next
Step 2: Allocate RAM
- Minimum: 2048 MB (2 GB)
- Recommended: 4096 MB (4 GB) or more
- Don't allocate more than 50% of your host RAM
Step 3: Create Virtual Hard Disk
- Select "Create a virtual hard disk now"
- Disk file type: VDI (VirtualBox Disk Image)
- Disk size: 25 GB minimum (50 GB recommended)
- Preallocated vs Dynamically allocated: Choose dynamically to save host disk space
Configure VM Settings
Right-click your VM → Settings, then adjust:
System
- Processor: 2 CPUs minimum (4 recommended)
- Enable "PAE/NX" and "Hardware Virtualization"
Display
- Video Memory: 128 MB
- Enable "3D Acceleration" for desktop environments
Storage
- Select the empty optical drive under Controller: IDE
- Click the disk icon → "Choose a disk file"
- Select your Linux ISO
Network
- NAT: Default — VM shares host's internet connection
- Bridged Adapter: VM gets its own IP on your network
- Host-Only: VM can only communicate with the host
Install Linux in the VM
- Start the VM — it will boot from the ISO
- Choose "Try or Install" then follow the installer prompts
- Select installation type:
- Erase disk: Safe in a VM — erases only the virtual disk
- Something else: For custom partitioning
- Create your user account and set a password
- Wait for installation to complete, then reboot
Install Guest Additions (Important)
# After Linux is installed in the VM:
# In VirtualBox menu: Devices → Insert Guest Additions CD Image
sudo mount /dev/cdrom /media/cdrom
sudo /media/cdrom/VBoxLinuxAdditions.run
# Reboot the VM for changes to take effect
This enables shared clipboard, drag-and-drop files, and better display resolution.
Host-Specific Notes
macOS (Intel)
- Enable "Nested Virtualization" in System Settings if available
- Apple Silicon Macs: Use UTM instead — see our UTM guide
Windows
- Enable "Virtual Machine Platform" and "Hyper-V" in Windows Features if needed
- If VirtualBox conflicts with Hyper-V, disable Hyper-V:
bcdedit /set hypervisorlaunchtype off
Linux Host
- Add your user to the vboxusers group:
sudo usermod -aG vboxusers $USER - Log out and back in for group changes to take effect
Troubleshooting
- "Kernel driver not installed": Run
sudo /sbin/vboxconfigon Linux hosts - Poor performance: Increase CPU cores and RAM allocation
- No 3D acceleration on macOS: This is a known limitation — use software rendering