Install Ubuntu on VirtualBox

Khimananda Oli 8 min read Virtualization
Install Ubuntu on VirtualBox

By Khimananda Oli | Last reviewed: August 2026

You need a reliable Linux environment for development or testing without dedicating physical hardware, and the most direct path is to install Ubuntu on VirtualBox. This process creates an isolated virtual machine that mirrors production server behavior while keeping your host system intact. Whether you are preparing for a DevOps certification or building a local lab to practice initial Ubuntu server setup, getting the virtualization layer right prevents hours of debugging later.

Host System (Windows / macOS / Linux)Oracle VM VirtualBox HypervisorVirtual StoragevCPU / RAMNetwork AdapterDisplayUbuntu 24.04 LTS Guest VMEXT4 FilesystemSystemd + User Space
VirtualBox abstracts physical hardware to create an isolated Ubuntu guest environment on your host machine.

How do I configure VirtualBox settings before installing Ubuntu?

The default "New VM" wizard in VirtualBox often suggests conservative resources that lead to sluggish performance during installation and runtime. When you install Ubuntu on VirtualBox, manual configuration upfront saves significant frustration. Start by selecting "Expert Mode" in the creation dialog to set parameters correctly from the beginning rather than editing them post-creation.

Resource Allocation Best Practices

  • Memory: Assign 4096 MB minimum for desktop Ubuntu; 2048 MB suffices for Ubuntu Server CLI-only. Never exceed 50% of your host’s physical RAM to prevent swapping.
  • Processors: Allocate 2 vCPUs minimum. Ubuntu 24.04’s installer and GNOME desktop stall on single-core configurations. Cap at half your host’s logical cores.
  • Storage: Use dynamically allocated VDI files. Set 25 GB minimum for desktop, 15 GB for server. The file only consumes actual disk space as data is written.
  • Graphics: Enable 3D Acceleration and set Video Memory to 128 MB under Display settings. Without this, the Ubuntu desktop renders via software fallback, causing input lag.

Network Configuration for Development

For most development workflows, switch the network adapter from NAT to Bridged Adapter. NAT isolates the VM behind a virtual router, making it unreachable from other devices on your LAN. Bridged mode places the Ubuntu VM directly on your physical network with its own IP address, essential if you plan to SSH into the VM from your host terminal or test services across devices. If you are following a guide on hardening SSH key authentication, bridged networking allows realistic testing of firewall rules and fail2ban configurations.

# Verify network connectivity after first boot
ip addr show enp0s3
ping -c 4 8.8.8.8

# If using NAT and needing port forwarding instead:
# Configure in VirtualBox: Settings > Network > Port Forwarding
# Host Port 2222 -> Guest Port 22
ssh -p 2222 username@localhost

What are the exact steps to install Ubuntu on VirtualBox?

With the VM configured, the actual installation follows a predictable sequence. Download the Ubuntu 24.04 LTS ISO from the official release page—always verify the SHA256 checksum to rule out corrupted media, a common cause of mysterious installer crashes.

  1. Attach the ISO: In VM Settings → Storage, click the Empty optical drive, then select the Ubuntu ISO via the disk icon dropdown. Ensure "Live CD/DVD" is unchecked unless you want to persist changes to the ISO itself.
  2. Boot and Select Language: Start the VM. At the GRUB menu, choose "Try or Install Ubuntu." The live session loads entirely into RAM; this is your chance to verify hardware compatibility before committing to disk.
  3. Partitioning Strategy: For VirtualBox VMs, select "Erase disk and install Ubuntu." Manual partitioning adds complexity without benefit in a virtualized environment where the underlying storage is already abstracted. Enable LVM if you anticipate resizing volumes later.
  4. User and Hostname: Set a descriptive hostname like ubuntu-dev-vm rather than the generic default. Create a non-root user with sudo privileges; never run daily tasks as root inside the VM.
  5. Installation Completion: The installer copies files and configures the bootloader. Once finished, remove the ISO from the virtual drive (Devices → Optical Drives → Remove Disk) before restarting to avoid boot-looping back into the live session.
Attach Ubuntu ISOSettings > StorageBoot Live SessionVerify HardwarePartition & InstallErase Disk + LVMRemove ISO & RebootFirst Boot to DiskPost-Install Checklistapt update && apt upgradeInstall Guest AdditionsEnable Shared ClipboardDevices > Shared ClipboardBidirectional ModeCreate SnapshotMachine > Take SnapshotBaseline Clean State
Sequential workflow for installing Ubuntu on VirtualBox including critical post-install configuration steps.

Why won't Ubuntu display correctly after installation?

The most frequent issue engineers face when they install Ubuntu on VirtualBox is a low-resolution display stuck at 800x600 or 1024x768 with no option to change it. This occurs because the guest OS lacks the proprietary VirtualBox graphics driver and falls back to the generic EFI framebuffer. The fix is installing Guest Additions, which provide optimized video drivers, shared clipboard integration, and automatic window resizing.

Installing Guest Additions Correctly

Avoid using apt install virtualbox-guest-dkms from Ubuntu repositories. These packages are often version-mismatched with your host’s VirtualBox installation, causing kernel module compilation failures. Instead, use the bundled ISO that ships with your exact VirtualBox version:

# Update system and install build dependencies first
sudo apt update && sudo apt upgrade -y
sudo apt install -y build-essential dkms linux-headers-$(uname -r)

# Insert Guest Additions CD image via VirtualBox menu:
# Devices > Insert Guest Additions CD Image...

# Mount and run the installer
sudo mount /dev/cdrom /mnt
cd /mnt
sudo ./VBoxLinuxAdditions.run

# Reboot to activate kernel modules
sudo reboot

After reboot, verify installation succeeded by checking loaded kernel modules:

lsmod | grep vboxguest
# Expected output includes: vboxguest, vboxsf, vboxvideo

# Test dynamic resizing: drag the VM window corner.
# Resolution should adjust automatically without manual intervention.

How does VirtualBox compare to other virtualization options for Ubuntu?

VirtualBox isn’t the only hypervisor available, and choosing the wrong tool wastes time. Understanding trade-offs helps you decide whether to install Ubuntu on VirtualBox or pivot to an alternative based on your specific workload requirements.

FeatureVirtualBoxKVM/QEMUWSL2
Host CompatibilityWindows, macOS, LinuxLinux onlyWindows 10/11 only
Performance OverheadModerate (Type-2 hypervisor)Near-native (Type-1, kernel-integrated)Low (Hyper-V backend)
GUI Desktop SupportFull with Guest AdditionsPossible but complex setupLimited (WSLg beta)
Snapshots & CloningBuilt-in, intuitive UIVia libvirt/qcow2, CLI-heavyNot supported natively
USB PassthroughExtension Pack requiredNative USB/IP supportPartial, limited devices
Best ForCross-platform labs, learningProduction servers, CI runnersQuick CLI tools, Docker dev

If you’re running Linux natively and need production-grade performance for Kubernetes testing or database benchmarks, KVM is superior. But for cross-platform teams, students, or engineers who need GUI snapshots to safely experiment with system configurations, VirtualBox remains the pragmatic choice. For those exploring containerization alongside VMs, pairing VirtualBox with Docker containerization fundamentals provides a comprehensive local development stack.

VirtualBoxCross-PlatformWin / Mac / Linux HostGUI SnapshotsSafe ExperimentationModerate OverheadType-2 HypervisorKVM / QEMULinux Native OnlyKernel-Level PerformanceProduction GradeCI Runners / ServersNear-Native SpeedType-1 HypervisorWSL2Windows OnlyHyper-V BackendCLI FocusedLimited GUI / No SnapshotsFast StartupIntegrated TerminalChoose For:Learning LabsMulti-OS TestingGUI SnapshotsChoose For:Production WorkloadsKubernetes NodesMaximum PerformanceChoose For:Quick CLI TasksDocker DevelopmentWindows Integration
Decision matrix comparing VirtualBox, KVM, and WSL2 for different Ubuntu virtualization use cases.

What troubleshooting steps fix common VirtualBox Ubuntu issues?

Even with correct configuration, specific failure modes recur across thousands of installations. Recognizing these patterns accelerates resolution when you install Ubuntu on VirtualBox and encounter unexpected behavior.

Black Screen After GRUB Selection

This typically indicates incompatible graphics initialization. At the GRUB menu, press e to edit boot parameters. Append nomodeset to the line starting with linux, then press F10 to boot. This forces software rendering during installation. After successful install and Guest Additions setup, remove nomodeset from /etc/default/grub and run sudo update-grub to restore hardware acceleration.

Shared Clipboard Not Working

Bidirectional clipboard requires both Guest Additions AND explicit enablement. Navigate to Machine → Settings → General → Advanced and set "Shared Clipboard" to "Bidirectional." If it still fails, reinstall Guest Additions matching your exact VirtualBox version (check Help → About). Version mismatches between host VirtualBox 7.x and guest additions from 6.x silently disable clipboard integration.

VM Freezes During Installation

Disable 3D Acceleration temporarily in Display settings. Some host GPU drivers conflict with VirtualBox’s 3D passthrough during the Ubuntu installer’s compositing phase. Re-enable after installation completes and Guest Additions are active. Also verify VT-x/AMD-V is enabled in your host BIOS—virtualization extensions disabled at firmware level cause intermittent hangs under load.

Next Steps After Installing Ubuntu on VirtualBox

A fresh VM is a starting point, not a destination. Immediately after you install Ubuntu on VirtualBox, take a clean snapshot before any customization. This baseline lets you revert instantly if subsequent configuration breaks the system. Apply all security updates, configure SSH key authentication, and set up automated backups—even for disposable lab environments, practicing disciplined operations builds muscle memory for production work. If you’re building toward a DevOps career, treat every VM as a portfolio artifact; document your setup process and link it to projects demonstrating real infrastructure skills. Ready to secure your new environment? Review the UFW firewall configuration guide to harden your VM before exposing services. Need help architecting a complete home lab or troubleshooting persistent virtualization issues? Reach out directly for personalized guidance tailored to your infrastructure goals.

Frequently Asked Questions

You need at least 4GB RAM, 25GB disk space, and a 64-bit processor with virtualization enabled in BIOS. For smooth performance in 2026, allocate 8GB RAM and enable 3D acceleration in display settings.

Yes. Both Ubuntu Desktop and VirtualBox Base Package are open source and free for commercial deployment. Only the VirtualBox Extension Pack requires a paid license for enterprise features like USB 3.0 or PXE boot.

Use Ubuntu 24.04 LTS for production stability or 26.04 LTS if available. Avoid interim releases unless testing specific kernel features. Always download the official ISO from ubuntu.com to verify checksums before installation.

Install Guest Additions via Devices menu, then set Bidirectional clipboard mode in VM Settings under General. Reboot the guest after installation. Shared clipboard fails without matching Guest Additions and kernel headers.

Common causes include disabled VT-x/AMD-V in BIOS, insufficient video memory, or corrupted ISO. Enable hardware virtualization, allocate 128MB VRAM minimum, and verify your ISO SHA256 checksum matches the official release.

Allocate 4GB minimum for desktop usage, 8GB recommended for development workloads. Never exceed 50% of host physical RAM to prevent swapping. Adjust dynamically using Memory Ballooning in System settings if needed.

Yes. Use VBoxManage modifyhd to expand the VDI file, then run gparted inside Ubuntu to extend the partition. Back up snapshots first since resizing raw disks carries data loss risk during filesystem operations.

Enable 3D Acceleration in Display settings and install latest Guest Additions matching your VirtualBox version. Allocate sufficient VRAM and avoid software rendering. Performance issues often stem from missing kernel modules after updates.

Use Bridged Adapter for direct LAN access and independent IP addressing. NAT suffices for outbound internet only. Host-Only enables isolated host-guest communication. Configure static IPs via netplan when running server services consistently.

Add shared folder in VM Settings, check Auto-mount and Make Permanent options. Install Guest Additions, then mount manually or let auto-mount handle it. Ensure your user belongs to vboxsf group for access permissions.

Yes, but you must enable EFI in System settings and enroll Oracle signing keys. Some third-party drivers fail validation. Disable Secure Boot temporarily during initial setup, then re-enable after configuring trusted certificates properly.

Use Machine menu or Ctrl+Shift+S to create named snapshots instantly. Snapshots preserve full VM state including memory. Delete old snapshots regularly as they consume significant disk space and degrade I/O performance over time.

Yes, provided total allocated resources stay within host limits. Clone existing VMs to save setup time. Use linked clones for identical base configurations or full clones for independent environments requiring separate update cycles.

Mount the Guest Additions ISO from Devices menu and run autorun.sh with sudo. Alternatively install virtualbox-guest-dkms package via apt for automatic kernel module rebuilding. Always match Guest Additions version to host VirtualBox version exactly.

Install the Extension Pack for USB 2.0/3.0 support and add your user to vboxusers group on the host. Create USB filters in VM Settings to pass specific devices through. Reconnect devices after enabling filters.