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:
| Component | Minimum | Recommended |
|---|---|---|
| RAM | 4GB | 8GB or more |
| Storage | 25GB free | 50GB free |
| Processor | Dual-core | Quad-core |
| OS | Windows 10/11 or macOS 11+ | Latest version |
| Virtualization | VT-x/AMD-V enabled | Enabled in BIOS |
Step 1 — Download VirtualBox
- Go to virtualbox.org/wiki/Downloads
- Click on your operating system:
- Windows hosts for Windows users
- macOS hosts for Mac users
- Download and run the installer
- Follow the installation wizard with default settings
- Click Finish when done
Step 2 — Download Ubuntu ISO
- Go to ubuntu.com/download/desktop
- Download the latest Ubuntu LTS version (24.04 LTS recommended)
- 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
- Open VirtualBox
- Click “New” button
- Fill in the details:
| Field | Value |
|---|---|
| Name | Ubuntu 24.04 |
| Folder | Leave default |
| ISO Image | Select your downloaded Ubuntu ISO |
| Type | Linux |
| Version | Ubuntu (64-bit) |
- Check “Skip Unattended Installation”
- Click Next
Step 4 — Allocate RAM and CPU
On the Hardware screen:
| Setting | Recommended Value |
|---|---|
| Base Memory (RAM) | 4096 MB (4GB) |
| Processors | 2 CPUs |
| Enable EFI | Leave 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:
| Setting | Value |
|---|---|
| Create a Virtual Hard Disk Now | ✅ Selected |
| Disk Size | 25 GB minimum, 50 GB recommended |
| Pre-allocate Full Size | Leave unchecked (saves space) |
Click Next → Finish
Step 6 — Configure Display Settings
Before starting the VM, let’s optimize the display:
- Select your VM → click Settings
- Go to Display tab
- Set Video Memory to 128 MB
- Enable 3D Acceleration ✅
- Click OK
Step 7 — Install Ubuntu
- Select your VM and click Start
- The Ubuntu installer will boot automatically
- Select “Try or Install Ubuntu”
- Choose your language → click Install Ubuntu
- Select keyboard layout → click Next
- Choose “Normal Installation” → click Next
- Select “Erase disk and install Ubuntu” → click Install Now
Don’t worry — this only erases the virtual disk, not your real computer!
- Select your timezone → click Next
- Enter your name, username, and password
- Click Install
- Wait 10-15 minutes for installation to complete
- 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:
- In VirtualBox menu → click Devices → Insert Guest Additions CD
- In Ubuntu, open the Terminal
- 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
- 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!