Run Linux in VirtualBox

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

Create a New Virtual Machine

Step 1: Click "New"

  1. Name your VM (e.g., "Ubuntu 24.04")
  2. Folder location can stay default
  3. Click Next

Step 2: Allocate RAM

Step 3: Create Virtual Hard Disk

  1. Select "Create a virtual hard disk now"
  2. Disk file type: VDI (VirtualBox Disk Image)
  3. Disk size: 25 GB minimum (50 GB recommended)
  4. Preallocated vs Dynamically allocated: Choose dynamically to save host disk space

Configure VM Settings

Right-click your VM → Settings, then adjust:

System

Display

Storage

  1. Select the empty optical drive under Controller: IDE
  2. Click the disk icon → "Choose a disk file"
  3. Select your Linux ISO

Network

Install Linux in the VM

  1. Start the VM — it will boot from the ISO
  2. Choose "Try or Install" then follow the installer prompts
  3. Select installation type:
    • Erase disk: Safe in a VM — erases only the virtual disk
    • Something else: For custom partitioning
  4. Create your user account and set a password
  5. 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)

Windows

Linux Host

Troubleshooting