How to Install Ubuntu in Virtual Machine: Complete Step-by-Step Installation Guide for Beginners

How to install Ubuntu in VM step by step installation guide

I remember the first time I installed Linux, I was terrified of wiping out my Windows partition by accident. A virtual machine solved that problem completely — it let me experiment, break things, and learn without any risk to my actual computer. If you’re in that same spot right now, wanting to try Ubuntu without committing to a dual-boot or a full wipe, this guide walks through the entire process from picking your virtualization software to getting a working Ubuntu desktop up and running.

Why Use a Virtual Machine for Ubuntu

A virtual machine (VM) is a software-emulated computer running inside your actual computer. It gets its own virtual hard disk, virtual RAM allocation, and virtual network adapter, all while your host operating system keeps running normally alongside it. This means you can install Ubuntu, mess with system settings, practice destructive commands, or test software, and if something goes catastrophically wrong, you just delete the VM and start fresh — your actual computer is never touched.

This is genuinely the best way to learn Linux if you’re new to it. It’s also how a lot of professional sysadmins test configuration changes before applying them to production servers, so the skills you build here carry over directly into real-world work.

Choosing Virtualization Software

There are a few solid options depending on your host operating system and needs:

VirtualBox — Free, open-source, cross-platform (Windows, macOS, Linux). This is the most common starting point for beginners because of its simple GUI and huge amount of online documentation.

VMware Workstation Player — Free for personal use, available on Windows and Linux, generally considered to have slightly better performance and 3D graphics support than VirtualBox, with a more polished interface.

GNOME Boxes — If your host system is already Linux, this is a lightweight, simple option built on top of QEMU/KVM, tightly integrated with the GNOME desktop.

Hyper-V — Built into Windows 10/11 Pro and Enterprise editions. No extra download needed if you already have a qualifying Windows edition, though it’s less beginner-friendly to configure than VirtualBox.

For this guide, I’ll focus on VirtualBox since it’s free, cross-platform, and the most commonly used option for exactly this scenario.

Step 1: Check Your System Requirements

Before installing anything, confirm your host machine can handle running a VM comfortably. Ubuntu Desktop’s official minimum requirements are roughly:

If your VM runs painfully slowly, the first thing to check is whether hardware virtualization is actually enabled in your BIOS, since without it, VirtualBox falls back to much slower software emulation.

Step 2: Download VirtualBox

Head to the official VirtualBox download page and grab the installer for your host operating system (Windows, macOS, or Linux). Avoid third-party download mirrors — always download directly from the official source to avoid tampered installers.

Once downloaded, run the installer and accept the default options unless you have a specific reason to change them. On Windows, this includes installing a network interface driver, which may briefly disconnect your network connection during install — that’s expected and normal.

Step 3: Download the Ubuntu ISO

Go to Ubuntu’s official downloads page and get the latest LTS (Long Term Support) release ISO — currently Ubuntu 24.04 LTS at the time of writing. LTS releases get five years of security updates and are the standard recommendation for anyone not specifically chasing the newest features, since they’re more stable and better tested.

The ISO file is a complete disk image of the Ubuntu installer, typically around 5-6 GB. Depending on your connection, this download can take a while, so it’s worth checking the SHA256 checksum listed on the download page against your downloaded file to confirm it wasn’t corrupted:

On Linux or macOS:

sha256sum ubuntu-24.04-desktop-amd64.iso

On Windows (PowerShell):

Get-FileHash ubuntu-24.04-desktop-amd64.iso -Algorithm SHA256

Compare the output against the checksum published on Ubuntu’s official site. If they don’t match, redownload the ISO before proceeding — a corrupted ISO can cause bizarre, hard-to-diagnose installation failures.

Step 4: Create a New Virtual Machine

Open VirtualBox and click “New.” You’ll be walked through a setup wizard:

  1. Name and Operating System — Give it a name like “Ubuntu-24.04.” VirtualBox usually auto-detects the type and version as “Linux / Ubuntu (64-bit)” based on the name you type, which is convenient.
  2. Memory Size — Allocate RAM for the VM. 4 GB (4096 MB) is a reasonable minimum for a smooth desktop experience; 8 GB if your host machine can spare it.
  3. Hard Disk — Choose “Create a virtual hard disk now.” Use the VDI format (VirtualBox’s native format) unless you have a specific reason for VMDK or another format. Choose “dynamically allocated” so the virtual disk file only grows as you actually use space, rather than reserving the full amount immediately. Allocate at least 25 GB, though 40-50 GB gives you more comfortable room if you plan to install additional software.
  4. Processor — In the VM’s settings (under System > Processor), allocate at least 2 CPU cores if your host has 4 or more physical cores available. This noticeably improves responsiveness.

Step 5: Attach the ISO and Boot

With the VM created, select it and click “Settings,” then go to “Storage.” Under the Controller, click the empty optical drive icon and choose “Choose a disk file,” then select the Ubuntu ISO you downloaded. This effectively mounts the ISO as a virtual DVD the VM will boot from.

Start the VM by clicking “Start.” It should boot straight into the Ubuntu live installer environment, giving you the option to “Try Ubuntu” (a live session without installing anything) or “Install Ubuntu” directly.

Step 6: Run Through the Ubuntu Installer

Click “Install Ubuntu” and work through the setup screens:

Click through to begin installation. This typically takes 10-20 minutes depending on your host machine’s speed. Once finished, you’ll be prompted to restart the VM.

Step 7: Remove the Installation Media

After the reboot prompt appears, VirtualBox usually handles ejecting the virtual ISO automatically, but if the VM tries to boot into the installer again, go to Devices > Optical Drives in the VM window and manually remove the ISO, then restart the VM.

You should now boot straight into a fresh Ubuntu desktop, ready to log in with the account you created.

Step 8: Install Guest Additions

This step is easy to skip but genuinely matters for usability. VirtualBox Guest Additions is a package that improves integration between your host and the VM: better screen resolution scaling, shared clipboard, drag-and-drop file support, and smoother mouse pointer integration.

Inside the running VM, go to the VirtualBox window menu and select “Devices > Insert Guest Additions CD image.” This mounts a virtual CD inside the guest. Open a terminal inside Ubuntu and run:

sudo apt update
sudo apt install build-essential dkms linux-headers-$(uname -r)

These packages are required to compile the Guest Additions kernel modules. Then navigate to the mounted CD and run the installer:

cd /media/$USER/VBox_GAs_*
sudo ./VBoxLinuxAdditions.run

Reboot the VM afterward:

sudo reboot

After reboot, you should be able to resize the VM window and have Ubuntu’s resolution adjust automatically — a small but very satisfying quality-of-life improvement.

Step 9: Enable Shared Folders and Clipboard (Optional)

If you want to move files between your host machine and the VM easily, go to VM Settings > Shared Folders and add a folder from your host. In the VM, this folder becomes accessible under /media/sf_<foldername> once Guest Additions is installed. You may need to add your user to the vboxsf group first:

sudo usermod -aG vboxsf $USER

Then log out and back in for the group change to take effect.

For clipboard sharing, go to VM Settings > General > Advanced and set “Shared Clipboard” and “Drag’n’Drop” to “Bidirectional.”

Common Issues and Troubleshooting

VM won’t start, error about VT-x/AMD-V not available — Hardware virtualization is disabled in your BIOS/UEFI, or another hypervisor (like Hyper-V on Windows) is conflicting with VirtualBox. On Windows, you may need to disable Hyper-V or Windows Hypervisor Platform if you’re not using them, since they can lock virtualization extensions away from VirtualBox.

Installer runs extremely slowly — Confirm you’ve allocated enough RAM and at least 2 CPU cores in VM settings. Also check that “Enable VT-x/AMD-V” and “Enable Nested Paging” are checked under VM Settings > System > Acceleration.

Black screen after boot — Try adjusting the graphics controller under VM Settings > Display. VBoxSVGA generally works well for modern Ubuntu releases; VMSVGA is another option worth trying if you hit rendering issues.

Screen resolution stuck at a small size — This almost always means Guest Additions isn’t installed properly. Revisit Step 8 and confirm the installation completed without errors.

Ubuntu installer can’t find the ISO / boots into a shell — Double check the ISO is correctly attached in Storage settings and that the checksum matched during download (a corrupted ISO can behave this way).

Real-World Uses Beyond Learning

Once you’re comfortable with this setup, VMs become genuinely useful tools beyond just learning Linux basics. Sysadmins use them to test configuration changes and software updates in an isolated environment before touching production. Developers use them to test how their software behaves in a clean environment without any of their host machine’s accumulated cruft. Security researchers use isolated VMs (often with networking disabled or restricted) to safely examine potentially malicious files. And plenty of people just keep a Ubuntu VM around as a permanent sandbox for trying new tools without any risk to their main system.

Alternatives Worth Knowing About

If VirtualBox feels sluggish on your hardware, VMware Workstation Player is worth trying as a free alternative with often better 3D acceleration. If you’re already running Linux as your host, GNOME Boxes or virt-manager (a GUI front-end for KVM/QEMU) tend to offer better raw performance since KVM is a Linux-native hypervisor, closer to the hardware than VirtualBox’s approach.

For quick, disposable testing without a full GUI installation, Ubuntu also publishes minimal cloud images designed for tools like multipass, which spins up lightweight Ubuntu VMs from the command line in seconds — worth exploring once you’re past the beginner stage and want faster iteration.

Summary

Installing Ubuntu inside a virtual machine is genuinely the safest and most beginner-friendly way to start learning Linux. You get a real, fully functional Ubuntu system to experiment with, while your actual computer remains completely untouched. Once VirtualBox is installed, downloading the ISO, creating the VM, and running through the installer takes maybe half an hour total, and Guest Additions rounds out the experience so it feels close to running Ubuntu natively. From here, you have a safe playground to practice everything else you’ll learn about Linux — package management, the command line, system administration — without any fear of breaking something you can’t easily undo.

References

Exit mobile version