How to Set Up Ubuntu on VirtualBox — Step by Step Guide 2026

Want to try Ubuntu Linux without replacing your current operating system? VirtualBox is the perfect solution. It lets you run Ubuntu inside a virtual machine on Windows or macOS — completely free and risk-free.

In this guide, we’ll walk you through how to set up Ubuntu on VirtualBox step by step, from downloading the software to getting your virtual machine up and running.


What is VirtualBox?

VirtualBox is a free, open-source virtualization software developed by Oracle. It allows you to run multiple operating systems simultaneously on the same computer — each in its own isolated virtual machine (VM).

Why use VirtualBox for Ubuntu?

  • ✅ Try Ubuntu without replacing Windows or macOS
  • ✅ Safe testing environment — mistakes don’t affect your main OS
  • ✅ Perfect for learning Linux commands
  • ✅ Great for web development and server testing
  • ✅ Completely free

System Requirements

Before we start, make sure your computer meets these requirements:

ComponentMinimumRecommended
RAM4GB8GB or more
Storage25GB free50GB free
ProcessorDual-coreQuad-core
OSWindows 10/11 or macOS 11+Latest version
VirtualizationVT-x/AMD-V enabledEnabled in BIOS

Step 1 — Download VirtualBox

  1. Go to virtualbox.org/wiki/Downloads
  2. Click on your operating system:
    • Windows hosts for Windows users
    • macOS hosts for Mac users
  3. Download and run the installer
  4. Follow the installation wizard with default settings
  5. Click Finish when done

Step 2 — Download Ubuntu ISO

  1. Go to ubuntu.com/download/desktop
  2. Download the latest Ubuntu LTS version (24.04 LTS recommended)
  3. The ISO file is about 5GB — wait for the download to complete

Tip: Download Ubuntu LTS (Long Term Support) versions for better stability and 5 years of security updates.


Step 3 — Create a New Virtual Machine

  1. Open VirtualBox
  2. Click “New” button
  3. Fill in the details:
FieldValue
NameUbuntu 24.04
FolderLeave default
ISO ImageSelect your downloaded Ubuntu ISO
TypeLinux
VersionUbuntu (64-bit)
  1. Check “Skip Unattended Installation”
  2. Click Next

Step 4 — Allocate RAM and CPU

On the Hardware screen:

SettingRecommended Value
Base Memory (RAM)4096 MB (4GB)
Processors2 CPUs
Enable EFILeave unchecked

Note: Don’t allocate more than 50% of your total RAM to the VM. If you have 8GB RAM, allocate 4GB to the VM.

Click Next


Step 5 — Create a Virtual Hard Disk

On the Virtual Hard Disk screen:

SettingValue
Create a Virtual Hard Disk Now✅ Selected
Disk Size25 GB minimum, 50 GB recommended
Pre-allocate Full SizeLeave unchecked (saves space)

Click Next → Finish


Step 6 — Configure Display Settings

Before starting the VM, let’s optimize the display:

  1. Select your VM → click Settings
  2. Go to Display tab
  3. Set Video Memory to 128 MB
  4. Enable 3D Acceleration ✅
  5. Click OK

Step 7 — Install Ubuntu

  1. Select your VM and click Start
  2. The Ubuntu installer will boot automatically
  3. Select “Try or Install Ubuntu”
  4. Choose your language → click Install Ubuntu
  5. Select keyboard layout → click Next
  6. Choose “Normal Installation” → click Next
  7. Select “Erase disk and install Ubuntu” → click Install Now

Don’t worry — this only erases the virtual disk, not your real computer!

  1. Select your timezone → click Next
  2. Enter your name, username, and password
  3. Click Install
  4. Wait 10-15 minutes for installation to complete
  5. Click Restart Now when prompted

Step 8 — Install VirtualBox Guest Additions

Guest Additions improves your VM experience with:

  • Full-screen mode
  • Shared clipboard between host and VM
  • Better display resolution
  • Shared folders

After Ubuntu boots:

  1. In VirtualBox menu → click Devices → Insert Guest Additions CD
  2. In Ubuntu, open the Terminal
  3. Run these commands:

bash

sudo apt update
sudo apt install build-essential dkms linux-headers-$(uname -r) -y
sudo mount /dev/cdrom /mnt
sudo /mnt/VBoxLinuxAdditions.run
  1. Restart the VM:

bash

sudo reboot

Now you can use Ubuntu in full-screen mode! 🎉


Step 9 — Update Ubuntu

After installation, update your system:

bash

sudo apt update && sudo apt upgrade -y

This ensures you have the latest security patches and software updates.


Useful VirtualBox Tips

Take Snapshots: Before making major changes, take a snapshot so you can restore if something goes wrong:

  • Machine → Take Snapshot → Name it descriptively

Shared Clipboard: Enable copy-paste between your main OS and Ubuntu:

  • Devices → Shared Clipboard → Bidirectional

Shared Folders: Access files from your main OS inside Ubuntu:

  • Devices → Shared Folders → Add a folder

Full Screen Mode: Press Right Ctrl + F to toggle full-screen mode


Troubleshooting Common Issues

VirtualBox won’t start the VM: Enable virtualization in BIOS/UEFI:

  • Restart your computer
  • Enter BIOS (usually F2, F10, or Delete key)
  • Enable Intel VT-x or AMD-V

Ubuntu is very slow:

  • Increase RAM allocation to 4GB+
  • Enable 3D acceleration in Display settings
  • Install VirtualBox Guest Additions

No internet in Ubuntu VM:

  • Go to VM Settings → Network
  • Make sure Adapter 1 is enabled
  • Set Attached to: NAT

Black screen after install:

  • Power off the VM
  • Settings → Display → Disable 3D Acceleration
  • Start the VM again

Final Thoughts

Setting up Ubuntu on VirtualBox is one of the best ways to learn Linux without any risk to your main computer. Once you’re comfortable with Ubuntu in a VM, you can consider installing it as your main operating system or on a dedicated machine.

Key takeaways:

  • VirtualBox is free and works on Windows and macOS
  • Allocate at least 4GB RAM and 25GB storage to your VM
  • Always install Guest Additions for the best experience
  • Use snapshots before making major changes

Are you new to Linux or an experienced user? Share your experience in the comments! 👇


Found this helpful? Check out our Linux & Ubuntu category for more Linux tutorials!

Leave a Comment