How to Install Ubuntu in Oracle VirtualBox
Create an Ubuntu virtual machine in Oracle VirtualBox, allocate RAM and disk space, attach an ISO, install Ubuntu, and complete post-installation setup.
Oracle VirtualBox lets you run Ubuntu inside a virtual machine (VM) on your existing computer. This guide explains how to create the VM, attach an Ubuntu ISO image, install Ubuntu to a virtual hard disk, and prepare the guest for everyday use.
A host operating system is the operating system installed directly on your physical computer. VirtualBox runs on that host. A guest operating system is the system installed inside the VM; in this guide, the guest is Ubuntu. The VM behaves like a software-defined computer with virtual hardware such as memory, a processor, a hard disk, and an optical drive.
Prerequisites for an Ubuntu Virtual Machine
Install Oracle VirtualBox on the host
Install Oracle VirtualBox on the physical computer that will run Ubuntu. Use the installer appropriate for your host operating system and accept the standard installation options unless you have a specific networking or storage requirement. You can review the separate installation guides for Windows or Linux.
After installation, open VirtualBox Manager. This application is where you create, configure, start, and manage virtual machines.
Download an Ubuntu ISO image
Download an Ubuntu installation ISO image from an official Ubuntu source. An ISO is a disk image file containing bootable installation media. Record where the file is saved, and avoid selecting an incomplete download. The ISO should match the computer architecture supported by your host and the Ubuntu release you intend to install.
Check host resources
Before creating the VM, confirm that the host has enough free disk space and RAM. The virtual hard disk is stored as a file on the host, so its maximum size must fit within the destination drive. The VM also consumes its assigned RAM while it is running, leaving less memory for the host and its applications.
| Use case | Suggested RAM approach | Suggested virtual disk approach | Host resource considerations |
|---|---|---|---|
| Basic desktop use | Assign a moderate amount of memory, commonly around 4 GB when the host has sufficient RAM. | Use a dynamically allocated disk with enough capacity for Ubuntu, updates, and a few applications. | Leave enough RAM and processor capacity for the host to remain responsive. |
| Development or multiple applications | Assign more memory if the host can spare it, especially for development tools, browsers, or multiple services. | Choose a larger disk and monitor the host drive as projects and packages grow. | Do not give the VM most of the host's memory. The host still needs resources to run VirtualBox. |
| Low-resource host | Use a smaller allocation and consider a lightweight Ubuntu desktop configuration. | Use a carefully sized dynamic disk and avoid storing unnecessary large files in the guest. | Close host applications before starting the VM and expect slower performance. |
Create a New Virtual Machine
- Open VirtualBox Manager.
- Select New to open the VM creation workflow.
- Enter a recognizable name, such as
Ubuntu Desktop 24.04or a name that identifies the intended release. - For the operating system family, select Linux.
- For the operating system version, select Ubuntu, choosing the 32-bit or 64-bit entry when the interface provides that choice.
- Continue through the wizard to configure memory and storage.
The selected operating system type tells VirtualBox which default settings are suitable for the guest. It does not install Ubuntu and it does not replace the host operating system. It simply helps VirtualBox choose compatible defaults. You can adjust many settings later.
For a more detailed overview of this workflow, see Create a Virtual Machine.
Allocate Virtual Machine Memory
Virtual machine memory, or RAM allocation, is the amount of host memory made available to Ubuntu while the VM runs. It is not permanently removed from the host, but the allocation is actively consumed during operation.
- Use the memory slider or input field in the VM wizard.
- Select enough memory for the intended Ubuntu workload.
- Keep the value inside the safe range shown by VirtualBox, and leave substantial memory for the host.
A basic Ubuntu desktop VM often works well with a moderate allocation such as 4 GB on a host with adequate RAM. Development tools, large applications, or several simultaneous guest programs may benefit from more. A low-resource host may require less memory and a lighter workload. Avoid assigning so much RAM that the host begins swapping heavily or becomes unresponsive.
Memory settings can be changed later while the VM is powered off. See VirtualBox memory management for related configuration concepts.
Create and Configure a Virtual Hard Disk
A virtual hard disk is a file, or group of files, stored on the host. Ubuntu sees this file as a normal hard drive and installs its system files there. The virtual disk is separate from the host's physical disk partitions as far as the guest is concerned, although it still consumes real host storage.
- Choose to create a new virtual hard disk.
- Set a meaningful disk file name if VirtualBox allows it.
- Choose a storage location with sufficient free space.
- Select VDI, the VirtualBox Disk Image format, when the wizard asks for a disk image format.
- Set the maximum capacity based on Ubuntu, updates, applications, and personal files you plan to store.
For a basic desktop installation, a virtual disk in the tens of gigabytes is generally more practical than the minimum required by the installer. Development environments, cached packages, source trees, media, and personal files need additional space. The configured capacity is the maximum storage that Ubuntu can see, while the amount immediately consumed on the host depends on the allocation method.
You may choose an alternate storage location instead of the default VirtualBox folder. A larger secondary drive can be preferable when the system drive is nearly full or when you want VM files grouped on a dedicated disk. Confirm that the destination has enough free capacity for the disk's current and future growth.
A VDI file can be copied or moved between compatible VirtualBox hosts when the VM is shut down and its related files are kept together. Portability does not mean the file is independent of all configuration: preserve the VM definition, disk files, snapshots, and any required settings when moving a complete VM.
For related storage concepts, read about virtual disks and disk image files.
Choose Dynamic or Fixed-Size Storage
A dynamically allocated disk grows on the host as Ubuntu writes data, up to the maximum capacity configured in the wizard. Ubuntu sees the configured maximum capacity even though the host initially stores only the data that has been written.
A fixed-size disk reserves its full configured capacity on the host when it is created. The guest also sees that configured capacity, but the host pays the storage cost immediately.
| Option | Host storage behavior | Creation time | Advantages | Considerations | Best fit |
|---|---|---|---|---|---|
| Dynamically allocated | Uses host space progressively as guest data is written, up to the maximum. | Usually faster to create. | Does not immediately reserve the full maximum size; convenient for general-purpose VMs. | Host storage can become full if growth is not monitored. Some workloads may have different performance characteristics. | Most Ubuntu desktop installations and hosts where storage should grow only as needed. |
| Fixed-size | Reserves the complete configured capacity at creation time. | Usually takes longer because the space is allocated in advance. | Storage is preallocated and capacity is predictable; it may provide more consistent performance in some workloads. | Consumes the full capacity immediately and requires that much free host space before creation. | Hosts where preallocation is desired and sufficient storage is already available. |
Either allocation type can be used for Ubuntu. Dynamic allocation is a practical default for a basic VM because it avoids immediately reserving the entire maximum size. Fixed-size storage is appropriate when you intentionally want to preallocate the space.
Attach the Ubuntu ISO as Virtual Optical Media
A virtual optical disk is a virtual CD/DVD drive. Attaching the Ubuntu ISO to this drive makes the VM treat the ISO like an inserted installation DVD.
- Finish creating the VM, or open the VM's Storage settings in VirtualBox Manager.
- Select the virtual optical drive under the storage controller.
- Choose the option to add or select an optical disk image.
- Browse to the downloaded Ubuntu ISO and select it.
- Confirm that the ISO appears as attached media for the VM.
Some VirtualBox versions offer a start-up media selection screen when you first start the VM. Selecting the Ubuntu ISO there performs the same essential task. Ensure the VM can boot from the virtual optical drive for the first installation start.
If the VM does not boot from the installer, verify the ISO attachment, confirm that the ISO download is complete and valid, and check that optical media is prioritized appropriately in the VM boot order.
For optical-drive configuration, see Add a DVD or CD-ROM drive.
Start the VM and Install Ubuntu
- Select the new Ubuntu VM in VirtualBox Manager.
- Click Start.
- When the VM boots, allow it to start from the attached Ubuntu ISO.
- Follow the Ubuntu installer prompts inside the VM window.
The standard Ubuntu installer asks for choices such as installation language, keyboard layout, network or installation options, time zone, and user account details. Choose the options appropriate for your location and intended use. Create a guest username and a strong password; these credentials are for Ubuntu, not for the host operating system.
When the installer asks where to install Ubuntu, select the VM's virtual hard disk. The installer is operating inside the guest, so its virtual disk is the intended target. Do not select or modify a host disk directly. If the VM has only the newly created virtual disk, the guided installation option is normally the simplest choice.
Continue through the installation until Ubuntu reports that it is complete. The VM may restart automatically or ask you to restart.
Detach the installation media after installation
After the first installation restart, eject or detach the Ubuntu ISO when prompted. You can also power off the VM and remove the ISO from its virtual optical drive in the Storage settings. This ensures that the VM boots from its virtual hard disk rather than starting the installer again.
If Ubuntu starts the installer again, the ISO is probably still mounted or the VM is still booting from the optical drive. Detach the ISO, confirm that the virtual hard disk is available, and restart the guest.
Verify the First Boot
- Allow the VM to boot without the ISO attached.
- Confirm that Ubuntu reaches its login or desktop screen.
- Sign in using the guest account created during installation.
- Check that the virtual disk and basic devices are visible to Ubuntu.
A normal boot from the virtual hard disk confirms that the core VM and installation are working. Keep the VM powered off when changing hardware settings such as memory, storage controllers, or boot media.
Update Ubuntu After the First Boot
After signing in, update Ubuntu so the guest has current package fixes and security updates. You can use Ubuntu's graphical software update tool or its terminal package manager. A typical terminal sequence is:
sudo apt update
sudo apt upgradeReview the packages and confirm the upgrade when prompted. Restart Ubuntu if the update process requests it. The exact packages and prompts vary by Ubuntu release.
Install VirtualBox Guest Additions
Guest Additions are VirtualBox guest software installed inside Ubuntu after the operating system is working. They improve integration between the host and guest, including display resizing, better mouse integration, clipboard sharing, and shared-folder support. They can also improve the general usability of the VM.
Install the Guest Additions that match the VirtualBox version running on the host, then restart Ubuntu if required. After installation, review the VM settings to enable the integration features you actually need. Clipboard sharing and shared folders can transfer information between systems, so enable them according to your security and workflow requirements.
See VirtualBox Guest Additions for the next setup step. Related topics include VirtualBox networking and taking a VM snapshot before major changes.
Troubleshooting Common Problems
The VM does not boot into the Ubuntu installer
- Open the VM's Storage settings and verify that the Ubuntu ISO is attached to the virtual optical drive.
- Confirm that you selected a complete, valid Ubuntu installation ISO.
- Check the VM boot order and ensure optical media can be used for the initial boot.
- Restart the VM after correcting the attachment or boot settings.
The host becomes slow or unresponsive
- Shut down the VM and reduce its RAM allocation.
- Close memory-intensive applications on the host before starting Ubuntu.
- Use a lighter Ubuntu configuration or reduce the number of applications running in the guest.
- Leave enough memory for the host operating system; assigning nearly all host RAM to the VM can make both systems unusable.
The virtual disk cannot be created or fills the host drive
- Check free space on the selected host drive and partition.
- Review the virtual disk's maximum capacity and its current host-side size.
- Remember that dynamic allocation is not unlimited: it still grows only while the host has free storage.
- Free space, reduce the planned disk size when appropriate, or choose a larger storage location.
Ubuntu starts the installer again after rebooting
- Eject or detach the Ubuntu ISO from the virtual optical drive.
- Confirm that the virtual hard disk is attached and is the normal boot target.
- Restart the guest.
Display resizing, mouse movement, or clipboard sharing is limited
- Install VirtualBox Guest Additions inside Ubuntu.
- Restart the guest if the installation requires it.
- Enable the desired display, mouse, clipboard, or shared-folder settings in VirtualBox.
Basic Ubuntu VM Configuration Checklist
- VirtualBox is installed on the host.
- The Ubuntu ISO came from an official source and is stored locally.
- The VM has a recognizable name.
- The operating system family is Linux and the version is Ubuntu.
- RAM allocation leaves the host usable.
- A VDI virtual hard disk has an appropriate maximum capacity.
- The disk location has enough room for current use and future growth.
- The Ubuntu ISO is attached to the virtual optical drive for installation.
- Ubuntu is installed on the virtual hard disk.
- The ISO is detached after installation so the VM boots normally.
- Ubuntu is updated and Guest Additions are considered for improved integration.