VMware ESXi and vSphere Cluster Management
Install Ubuntu in Oracle VirtualBox
Learn how to create an Ubuntu virtual machine in Oracle VirtualBox, attach an Ubuntu ISO, complete installation, and configure Guest Additions.
Oracle VirtualBox lets you run another operating system inside a window on your existing computer. This guide explains how to create an Ubuntu virtual machine (VM), install Ubuntu from an ISO image, validate the installation, and improve desktop integration with Guest Additions.
How Ubuntu virtualization works
Oracle VirtualBox is desktop virtualization software. It acts as a hosted hypervisor: it runs on top of an existing operating system and provides software-defined hardware to virtual machines.
The host operating system is the operating system installed directly on the physical computer. The guest operating system is the system installed inside the VM. In this guide, the host could be Windows, macOS, or Linux, while Ubuntu is the guest.
A VM behaves like a separate computer with virtual RAM, virtual CPUs, a virtual hard disk, a virtual optical drive, and network hardware. An Ubuntu ISO image is a disk-image file containing bootable installation media. When attached to the VM's virtual optical drive, it behaves like an Ubuntu installation DVD or USB device.
Prerequisites
- Install Oracle VirtualBox on the host computer.
- Download an Ubuntu Desktop ISO that matches your needs.
- Confirm that the host has enough unused RAM and disk space for both the host and the VM.
- Make sure hardware virtualization is available. If VirtualBox reports that it is unavailable, enable Intel VT-x or AMD-V in the computer's BIOS or UEFI when supported.
- Know where the ISO file is stored so it can be selected later.
Selecting the Ubuntu release and architecture
Use an Ubuntu release suitable for your course, applications, or support requirements. The desktop ISO must also match the host computer's supported CPU architecture. Most current desktop computers use 64-bit x86 architecture, commonly shown as amd64. ARM-based computers may require an ARM-compatible image and virtualization setup.
Choosing the wrong release or architecture can prevent the VM from booting, limit available software, or produce poor compatibility. Also check the ISO's download integrity when the Ubuntu distribution provides verification information.
Create the virtual machine
- Open VirtualBox Manager.
- Select New to start the virtual machine creation workflow.
- Enter a recognizable name, such as
Ubuntu Desktop Labor a name containing the intended release. - Choose Linux as the operating system family and Ubuntu as the version or subtype when available.
- Choose the folder where VirtualBox should store the VM files.
- Continue to memory, processor, and virtual disk configuration.
The VM name identifies the machine in VirtualBox Manager. VM settings describe its virtual hardware and startup behavior. The associated files, including the virtual disk, are stored on the host at the selected location. Changing a name in the manager does not necessarily rename every file, so manage the VM through VirtualBox rather than moving individual files while it is running.
Allocate virtual hardware
RAM
RAM allocation is the amount of host memory reserved for the VM while it runs. Ubuntu Desktop needs enough memory for the desktop, updates, and applications, but the host also needs memory to remain responsive. A practical starting point is a moderate allocation such as 4 GB when the host has sufficient memory. Increase it only when the host can spare it.
Virtual CPUs
A virtual CPU is a host processor execution resource presented to Ubuntu as a processor. One or two virtual CPUs may be enough for basic tasks. More virtual CPUs can improve compilation or multitasking, but assigning too many can reduce host responsiveness. Keep some processing capacity available to the host.
Depending on the VirtualBox version, processor settings appear during VM creation or under the VM's settings. In general, change RAM and processor settings only while the VM is powered off.
Create the virtual hard disk
A virtual hard disk is a file, or group of files, on the host that Ubuntu sees as an internal disk. It is not the same as a physical disk installed in the host.
- Choose to create a new virtual hard disk.
- Select VDI, which means VirtualBox Disk Image, as the disk format.
- Choose either dynamically allocated or fixed-size storage.
- Set the disk filename and storage location.
- Set the maximum capacity. Leave enough space for Ubuntu, updates, applications, and user data.
Dynamic allocation does not remove the need for free host storage. If the file grows until the host disk is full, Ubuntu and the host can both become unstable. A virtual disk can be copied or moved to another compatible VirtualBox installation, but the VM should be shut down first and all associated files should be kept together. VirtualBox export and import can simplify migration.
Attach the Ubuntu ISO
- Open the new VM's storage settings, or use the startup-media selection shown by your VirtualBox version.
- Select the virtual optical drive.
- Choose the downloaded Ubuntu ISO.
- Confirm that the ISO is mounted in the virtual optical drive.
- Check the VM's boot order, which is the sequence of devices checked at startup. Place the optical drive before the empty virtual hard disk for the initial installation.
The ISO acts like a bootable DVD or USB installer. It is read by the VM, not by the host as an ordinary application.
Run the Ubuntu installer
- Start the VM. It should boot from the attached ISO.
- Choose the language and continue to the Ubuntu desktop installer.
- Select the keyboard layout and test the layout if the installer offers that option.
- Configure network access if available. The installer may download updates or use network services during setup.
- Choose the normal or minimal installation and select optional third-party software according to your needs and the choices presented by the Ubuntu release.
- When asked for the installation destination, select the VM's virtual disk. The disk should appear as the empty disk created in VirtualBox.
- Review the disk changes carefully before confirming. Never select a host disk.
- Enter a computer name, create the Ubuntu user account, and choose a strong password.
- Allow the installer to copy files and configure the guest system.
- When installation finishes, reboot the VM.
- Remove or detach the Ubuntu ISO when prompted, or eject it from the virtual optical drive before the next boot.
Validate the first boot
After the reboot, Ubuntu should start from the installed virtual disk rather than from the ISO. Sign in with the account created during installation and check the following:
- The Ubuntu desktop opens and responds to mouse and keyboard input.
- The display resolution is usable and the desktop can be resized if the current integration supports it.
- The VM has network access when networking is required.
- Ubuntu reports the expected memory and processor resources.
- The virtual disk has enough available storage for updates and applications.
Apply Ubuntu updates after the first successful boot using the desktop's software-update tools. Updating improves security and may resolve compatibility issues before you install additional software.
Install VirtualBox Guest Additions
Guest Additions are VirtualBox drivers and guest software installed inside Ubuntu. They improve host-guest integration, including display resizing, pointer behavior, shared clipboard support, drag and drop where supported, shared folders, and other usability features.
- Start Ubuntu and sign in.
- Use the VirtualBox window menu to insert the Guest Additions virtual CD.
- Open the inserted disc inside Ubuntu and run its installer, following the instructions for the Ubuntu and VirtualBox versions in use.
- Allow any required packages or build steps to complete.
- Restart Ubuntu when requested.
- After the restart, enable features such as shared clipboard, drag and drop, or shared folders in the VM settings if needed.
Guest Additions may require build tools, kernel headers, or a matching kernel module. Requirements vary by Ubuntu and VirtualBox version. If installation reports a build error, update Ubuntu, confirm that the required development packages and kernel headers are available, and rerun the installer. A restart is commonly required before the drivers become active.
Troubleshooting
Key points to remember
- VirtualBox is the virtualization program; Ubuntu is the guest operating system.
- The Ubuntu ISO is temporary bootable installation media.
- The VDI virtual disk is a host-side file presented to Ubuntu as an internal disk.
- Dynamic disks grow as needed, while fixed-size disks reserve their capacity at creation.
- Balance VM RAM and virtual CPUs with the host's available resources.
- Detach the ISO after installation so the VM boots from its virtual hard disk.
- Install updates and Guest Additions after confirming the first successful boot.
For a related walkthrough, see Install Ubuntu 2.