Kokil Thapa - Professional Web Developer in Nepal
Freelancer Web Developer in Nepal with 15+ Years of Experience

Kokil Thapa is an experienced full-stack web developer focused on building fast, secure, and scalable web applications. He helps businesses and individuals create SEO-friendly, user-focused digital platforms designed for long-term growth.

Install Ubuntu on VirtualBox

By Kokil Thapa | Last reviewed: September 2026

You need a local Linux box without wiping your main OS. The fastest path is to install Ubuntu on VirtualBox—a free hypervisor that runs a full Ubuntu guest inside Windows or macOS. I use this setup daily for Laravel stacks, WordPress builds, and server hardening drills before touching production VPS hosts. This guide walks through ISO download, VM creation, the installer screens, Guest Additions, and the failures I see most often on real client machines.

If you already run Ubuntu elsewhere, skim our Ubuntu server setup guide for post-install hardening. Beginners should pair this page with the Ubuntu download and installation guide for edition and LTS context.

What do you need before you install Ubuntu on VirtualBox?

Hardware and software requirements are modest. VirtualBox 7.x runs on Windows 10/11, macOS, and Linux hosts. Your machine needs CPU virtualisation enabled in firmware—Intel VT-x or AMD-V. Most laptops ship with it on, but OEM images sometimes disable it.

Gather these items before you start:

  • Host RAM: 8 GB minimum; 16 GB is comfortable if the host also runs an IDE and browser tabs.
  • Disk space: 30–40 GB free for the VM file, snapshots, and ISO cache.
  • Ubuntu ISO: LTS desktop or server image from the official Ubuntu site.
  • VirtualBox: Latest stable build from Oracle, plus the Extension Pack if you need USB 2/3 passthrough.
  • Admin rights: Required on the host to install VirtualBox and load kernel modules.

For Nepal-based developers on mid-range laptops (Rs 80,000–120,000, ~USD 600–900), a 4 GB guest with two vCPUs matches most web development workflows without freezing the host during composer install or npm install.

Install Ubuntu on VirtualBox — Layer ViewPhysical HostWindows / macOS / Linux + RAM + SSDOracle VirtualBox 7.xHypervisor + virtual NIC + virtual diskUbuntu Guest VMDesktop or Server LTSPHP, Nginx, Docker, Git
How to install Ubuntu on VirtualBox: the host runs VirtualBox, which hosts an isolated Ubuntu guest for development.

Enable hardware virtualisation on the host

Reboot into firmware (often F2, F10, or Del). Look for Intel VT-x, Intel Virtualization Technology, or SVM Mode for AMD. Save and exit. On Windows, confirm Hyper-V is not blocking VirtualBox unless you deliberately use the Hyper-V backend.

Download Ubuntu and VirtualBox

Download Ubuntu 24.04 LTS (supported until 2029) from ubuntu.com/download. Pick Desktop for GUI work or Server for headless LAMP-style labs. Download VirtualBox from virtualbox.org. Install the host package, then optionally install the Extension Pack for the same version number.

Which Ubuntu edition should you choose for VirtualBox?

Edition choice drives RAM, disk, and daily workflow. Desktop gives you GNOME and a browser inside the guest. Server gives you a minimal CLI image suited to nginx, PHP-FPM, and MySQL practice aligned with production VPS layouts.

CriteriaUbuntu Desktop LTSUbuntu Server LTS
Best forGUI apps, VS Code, browser testingLEMP stacks, SSH-only workflows
Typical RAM4 GB guest2 GB guest (4 GB for Docker)
Disk30 GB dynamic20 GB dynamic
Install time15–25 minutes10–15 minutes
Matches productionPartiallyClosely mirrors VPS

I keep Desktop VMs for client UI reviews and Server VMs for LEMP stack labs on Ubuntu. After install, Server users SSH from the host with port forwarding or a bridged adapter.

How do you create a VirtualBox VM for Ubuntu?

VM settings matter more than many guides admit. Under-provisioned RAM causes swap thrashing. A disk that is too small breaks Docker and apt upgrade within weeks.

  1. Open VirtualBox → Machine → New.
  2. Name: Ubuntu-24.04-LTS. Folder: pick a fast SSD path with free space.
  3. Type: Linux. Version: Ubuntu (64-bit).
  4. Memory: 4096 MB for Desktop; 2048 MB minimum for Server-only labs.
  5. Hard disk: Create a virtual hard disk now → VDI → Dynamically allocated → 30 GB (Desktop) or 25 GB (Server).
  6. Before first boot: select the VM → Settings.

Under System → Processor, assign 2 CPUs (half your physical cores on a quad-core laptop). Enable PAE/NX if offered. Under Display → Screen, set Video Memory to 128 MB for Desktop. Enable 3D acceleration only if Guest Additions are installed; otherwise leave it off to avoid black screens.

Under Storage, click the empty optical drive → disk icon → Choose a disk file → select your Ubuntu ISO. Under Network, NAT works for internet out of the box. Use Bridged Adapter if the guest must appear on your LAN like a physical machine.

VirtualBox VM Creation FlowNew VMSet RAMCreate VDIAttach ISOBoot and InstallUbuntu on VirtualBoxTip: 4 GB RAM + 2 vCPU + 30 GB diskUse bridged NIC for LAN SSH access
Create the VirtualBox machine, attach the Ubuntu ISO, then boot into the installer to install Ubuntu on VirtualBox.

How do you install Ubuntu on VirtualBox step by step?

With the ISO mounted, click Start. The Ubuntu boot menu appears within a minute on SSD hosts.

Desktop installer walkthrough

  1. Select Try or Install Ubuntu (or Install Ubuntu directly).
  2. Choose language and keyboard layout.
  3. Pick Normal installation. Check Download updates while installing if your connection is stable.
  4. Installation type: Erase disk and install Ubuntu is safe—it only affects the virtual disk, not your host drive.
  5. Set timezone (Asia/Kathmandu for Nepal workflows).
  6. Create your user, hostname, and password. Use a strong password even on a VM.
  7. Wait for file copy and package configuration. Remove the ISO when prompted, then reboot.

After first login, open a terminal and run updates:

sudo apt update && sudo apt upgrade -y
sudo reboot

Server installs use a text-based wizard. Enable OpenSSH during setup if you plan to SSH from the host. That mirrors how I stage boxes before deploying Laravel on an Ubuntu VPS with Nginx.

Install VirtualBox Guest Additions

Guest Additions unlock auto-resize, shared clipboard, and smoother mouse integration. Without them, the guest feels broken on first boot.

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

In the VirtualBox menu: Devices → Insert Guest Additions CD image. Then mount and run the installer:

sudo mount /dev/cdrom /mnt
sudo /mnt/VBoxLinuxAdditions.run
sudo reboot

Official steps are documented in the VirtualBox Guest Additions manual. After reboot, drag the window corner—the guest desktop should resize with the frame.

Post-Install Dev Stack in Ubuntu VMUbuntu 24.04 LTS GuestPHP 8.3+Laravel 12 / 13Nginx + MySQLLEMP practiceDockerNode.js 26 LTSShared folders + Git + snapshotsMatch production before VPS deploy
After you install Ubuntu on VirtualBox, layer PHP, Nginx, MySQL, and Docker to mirror production servers.

Shared folders and snapshots

To edit code on the host and run it in the guest, configure a shared folder: VM Settings → Shared Folders → Add → pick a host path → mount point /media/shared. Add your user to the vboxsf group:

sudo usermod -aG vboxsf $USER
newgrp vboxsf

Take a snapshot named clean-install before installing PHP or Docker. Roll back in seconds when an experiment breaks apt or kernel headers. I use the same discipline on booking platforms like Adventure Third Pole Trek before server migrations.

Next steps for developers

Chain these installs inside the guest:

Validate JSON API payloads during integration work with our JSON formatter tool on the host while the guest runs the API.

How do you fix common VirtualBox Ubuntu install problems?

Most failures trace to firmware settings, display drivers, or stale ISO mounts—not a broken Ubuntu image.

Black screen after boot or login

Lower Video Memory to 64 MB. Disable 3D acceleration until Guest Additions finish. Boot with Safe Graphics from the GRUB menu if the installer UI never appears. On Apple Silicon Macs, note that VirtualBox does not emulate ARM Ubuntu on Apple hosts; use UTM or a cloud VM instead.

Install hangs at "Getting ready" or "Copying files"

Confirm the ISO checksum matches the download page. Detach other virtual drives. Allocate at least 2 GB RAM temporarily during install. Snapshots mid-install corrupt disks—let the process finish.

Network not working in the guest

NAT should work out of the box. If not, remove and re-add the adapter in VM settings. For static LAN IPs, switch to Bridged and pick your Wi-Fi or Ethernet interface. Corporate VPNs on the host sometimes block bridged traffic; fall back to NAT with port forwarding for SSH:

Host port 2222 → Guest port 22

Then connect: ssh -p 2222 youruser@127.0.0.1. Review UFW firewall configuration on Ubuntu inside the guest before exposing services.

Slow performance

Store the VDI on an SSD, not a spinning disk or network share. Give the guest an extra CPU if the host has headroom. Trim snapshots—you keep only what you need. Apply tips from speed up Ubuntu performance inside the guest. Disable GNOME animations on Desktop if RAM is tight.

VirtualBox Ubuntu TroubleshootingProblem?Black screenDisable 3D, add GANo networkReset NAT adapterVery slowSSD + more RAMGuest AdditionsBridged NIC2 vCPU + 4 GBSnapshot before major package changes
Decision paths when Install Ubuntu on VirtualBox hits black screens, network loss, or sluggish performance.

When to move from VirtualBox to a real VPS

Local VMs excel for learning and pre-deploy testing. They cannot simulate real latency, mail deliverability, or TLS edge cases. Once your stack runs cleanly, promote the same steps to a VPS using initial Ubuntu server setup in 20 minutes and Ubuntu security hardening. For managed infrastructure, see Linux system administration services.

Desktop users exploring GNOME tweaks should read the Ubuntu desktop complete guide. Terminal newcomers benefit from essential Ubuntu terminal commands before scripting cron jobs or file permissions.

Key Takeaways

  • Install Ubuntu on VirtualBox with 4 GB RAM, 2 vCPUs, and a 30 GB dynamic VDI on an SSD host path.
  • Attach the official Ubuntu 24.04 LTS ISO, choose Desktop for GUI work or Server for VPS-like CLI labs.
  • Install Guest Additions immediately after first boot for resize, clipboard, and shared-folder support.
  • Take a clean-install snapshot before adding PHP, Nginx, Docker, or Node.js stacks.
  • Fix black screens by disabling 3D acceleration until Guest Additions compile successfully.
  • Graduate to a secured VPS using the same packages once local tests pass.

People Also Ask

Is VirtualBox free for installing Ubuntu?

Yes. Oracle VirtualBox is free for personal and educational use. Ubuntu is also free and open source. You only pay for hardware and electricity. The Extension Pack is free for personal use but carries a separate license for commercial redistribution scenarios.

How much RAM does Ubuntu need in VirtualBox?

Ubuntu Server runs on 2 GB for basic SSH and nginx labs. Ubuntu Desktop needs 4 GB for a usable GNOME session with a browser and IDE. Assign half your host RAM at most—never starve the host OS or the guest will swap and feel frozen.

Can I install Ubuntu on VirtualBox on Windows 11?

Yes. Install VirtualBox for Windows hosts, enable VT-x in BIOS, create a 64-bit Ubuntu VM, and attach the ISO. If Hyper-V conflicts appear, either disable Hyper-V features or use VirtualBox 7.x with its Hyper-V backend option on supported builds.

Do I need Guest Additions after installing Ubuntu?

Strongly yes for Desktop installs. Guest Additions provide automatic screen resizing, shared clipboard, drag-and-drop, and better mouse integration. Server-only VMs can skip them if you never use a graphical console.

Build your Ubuntu lab, then ship to production

A clean install Ubuntu on VirtualBox session takes under an hour and saves days of production surprises. Match your guest stack to what you run on client projects—PHP 8.3+, Laravel 12 or 13, Nginx, MySQL 8.4+, Redis, and Node 26 LTS—then harden the same steps on a real server. Read more on the blog, browse the portfolio for shipped Ubuntu deployments, or contact us if you want a production VPS configured and maintained without the trial-and-error cycle.

Frequently Asked Questions

Yes. Oracle VirtualBox and Ubuntu are both free for personal and educational use. You only pay for host hardware and electricity. The Extension Pack is free for personal use but has a separate license for commercial redistribution.

Ubuntu Server needs 2 GB minimum for SSH and nginx labs. Ubuntu Desktop needs 4 GB for GNOME with a browser and IDE. Never assign more than half your host RAM or the guest will swap and freeze.

Yes. Install VirtualBox 7.x for Windows, enable Intel VT-x or AMD-V in BIOS, create a 64-bit Ubuntu VM, and attach the ISO. If Hyper-V conflicts appear, disable Hyper-V features or use VirtualBox 7.x with its Hyper-V backend option on supported builds.

Before starting, confirm CPU virtualisation is enabled in firmware—Intel VT-x or AMD-V. Your host needs 8 GB RAM minimum, though 16 GB is comfortable with an IDE and browser open. Reserve 30–40 GB free disk space for the VM file, snapshots, and ISO cache. Download Ubuntu 24.04 LTS from ubuntu.com and VirtualBox 7.x from virtualbox.org. Add the Extension Pack if you need USB 2 or 3 passthrough. Admin rights on the host are required to install VirtualBox and load kernel modules.

Ubuntu Desktop LTS suits GUI work—VS Code, browser testing, and client UI reviews—with 4 GB guest RAM and a 30 GB dynamic disk. Ubuntu Server LTS mirrors production VPS layouts for LEMP stack labs, needing 2 GB RAM minimum or 4 GB with Docker, and a 20–25 GB disk. Server installs take 10–15 minutes versus 15–25 for Desktop. Choose Desktop when you need GNOME inside the guest; choose Server when you plan to SSH from the host and practice nginx, PHP-FPM, and MySQL without a graphical console.

Open VirtualBox, choose Machine → New, name it Ubuntu-24.04-LTS, set Type to Linux and Version to Ubuntu 64-bit. Assign 4096 MB RAM for Desktop or 2048 MB for Server-only labs. Create a dynamically allocated VDI: 30 GB for Desktop or 25 GB for Server, stored on a fast SSD path. Under Processor, assign 2 CPUs. Set Video Memory to 128 MB for Desktop. Attach the Ubuntu ISO under Storage, then pick NAT for internet or Bridged Adapter if the guest must appear on your LAN.

With the ISO mounted, click Start and select Try or Install Ubuntu. Choose language, keyboard, and Normal installation. Check Download updates while installing if your connection is stable. Select Erase disk and install Ubuntu—it only affects the virtual disk, not your host drive. Set timezone to Asia/Kathmandu for Nepal workflows, create your user and password, then wait for file copy to finish. Remove the ISO when prompted and reboot. After first login, run sudo apt update and sudo apt upgrade -y, then reboot again.

Strongly yes for Desktop installs. Guest Additions unlock automatic screen resizing, shared clipboard, drag-and-drop, and smoother mouse integration. Without them, the guest feels broken on first boot. Install build-essential, dkms, and linux-headers first, then use Devices → Insert Guest Additions CD image in VirtualBox, mount the CD, and run VBoxLinuxAdditions.run. Reboot and drag the window corner—the desktop should resize with the frame. Server-only VMs can skip Guest Additions if you never use a graphical console and connect only via SSH.

Reboot into firmware—often F2, F10, or Del—and look for Intel VT-x, Intel Virtualization Technology, or SVM Mode on AMD systems. Save and exit. On Windows, confirm Hyper-V is not blocking VirtualBox unless you deliberately use the Hyper-V backend. Most laptops ship with virtualisation enabled, but OEM images sometimes disable it. Without VT-x or AMD-V active, VirtualBox cannot run a 64-bit Ubuntu guest and the VM creation wizard will fail or the guest will not boot.

Lower Video Memory to 64 MB under Display → Screen. Disable 3D acceleration until Guest Additions finish installing—enabling it beforehand often causes black screens. Boot with Safe Graphics from the GRUB menu if the installer UI never appears. On Apple Silicon Macs, VirtualBox does not emulate ARM Ubuntu; use UTM or a cloud VM instead. These display failures trace to firmware settings and display drivers, not a broken Ubuntu image. Re-enable 3D acceleration only after Guest Additions compile successfully and you have rebooted.

Confirm the ISO checksum matches the download page—a corrupted download is a common cause. Detach other virtual drives so only the Ubuntu ISO is mounted. Allocate at least 2 GB RAM temporarily during install if you under-provisioned the VM. Never take snapshots mid-install; interrupted writes corrupt the virtual disk. Let the process finish completely even if it appears stalled for several minutes on slower hosts. Store the VDI on an SSD rather than a spinning disk or network share to avoid timeouts during file copy.

NAT works out of the box for internet access from the guest and suits most development workflows. Switch to Bridged Adapter if the guest must appear on your LAN with its own IP, like a physical machine. Corporate VPNs on the host sometimes block bridged traffic; fall back to NAT with port forwarding for SSH—map host port 2222 to guest port 22, then connect with ssh -p 2222 youruser@127.0.0.1. If networking fails entirely, remove and re-add the adapter in VM settings before changing modes.

Allocate a 30 GB dynamic VDI for Ubuntu Desktop or 25 GB for Server. Dynamic allocation grows as you use space rather than reserving the full amount upfront. Keep 30–40 GB free on the host drive for the VM file, snapshots, and ISO cache combined. A disk that is too small breaks Docker and apt upgrade within weeks. Store the VDI on an SSD, not a spinning disk or network share, for acceptable install and daily performance.

For shared folders, open VM Settings → Shared Folders → Add, pick a host path, and set a mount point such as /media/shared. Add your user to the vboxsf group with sudo usermod -aG vboxsf $USER, then run newgrp vboxsf. Take a snapshot named clean-install before installing PHP, Docker, or other stack components. Roll back in seconds when an experiment breaks apt or kernel headers. Trim old snapshots regularly—they consume disk space and slow performance over time.

Local VMs excel for learning and pre-deploy testing but cannot simulate real latency, mail deliverability, or TLS edge cases. Once your stack runs cleanly inside the guest—PHP, Nginx, MySQL, Docker, or Node.js—promote the same steps to a secured VPS using initial Ubuntu server setup and security hardening guides. Match your guest stack to what you run on client projects, then harden the identical packages on production infrastructure rather than treating the VM as a permanent hosting environment.

Share this article

0 Comments

Leave a comment

Your email is not published. Comments appear once they have been read. Sign in to have your details filled in.

Quick Contact Options
Choose how you want to connect me: