Install Oracle VirtualBox Ubuntu: Step-by-Step
In this article
To install Ubuntu in Oracle VirtualBox, you download VirtualBox, create a virtual machine, attach the Ubuntu ISO, and run the installer. This guide covers the full process on Windows, macOS, or Linux hosts, with tips for smooth setup.
What You'll Need
- A computer with at least 4 GB of RAM (8 GB recommended) and about 25 GB of free disk space.
- The Ubuntu desktop ISO file (download from the official Ubuntu website). Choose the LTS version for stability.
- Oracle VirtualBox installed on your host system (download from virtualbox.org).
- Virtualization enabled in your BIOS/UEFI (usually on by default; check if you get errors later).
Step-by-Step
- Download VirtualBox – Go to virtualbox.org and download the installer for your host OS (Windows, macOS, or Linux). Run the installer and accept default settings. On Windows, you may be prompted to install drivers – click “Yes” to allow.
- Download Ubuntu ISO – Visit ubuntu.com/download/desktop and download the latest LTS ISO file. Save it somewhere you can find easily, like your Downloads folder.
- Open VirtualBox – Launch VirtualBox from your applications menu. You’ll see the main manager window.
- Create a New Virtual Machine – Click the “New” button (or press Ctrl+N). Name your VM (e.g., “Ubuntu 24.04”). VirtualBox will auto-detect the type as “Linux” and version as “Ubuntu (64-bit)” – verify these are correct. Click “Next”.
- Allocate Memory – Set the base memory (RAM) to at least 2048 MB (2 GB), but 4096 MB (4 GB) or more is better if your host has enough. The green line indicates the recommended maximum. Click “Next”.
- Create a Virtual Hard Disk – Choose “Create a virtual hard disk now” and click “Create”. Select “VDI (VirtualBox Disk Image)” and click “Next”. Choose “Dynamically allocated” (grows as you use it) and click “Next”. Set the disk size to at least 25 GB (50 GB is comfortable). Click “Create”.
- Adjust VM Settings (Optional but Recommended) – Select your VM in the list, click “Settings”. Under “System > Processor”, increase the CPU count to 2 or more if your host has multiple cores. Under “Display”, increase video memory to 128 MB and enable “3D acceleration” if you want smoother graphics. Close settings.
- Attach the Ubuntu ISO – With your VM selected, click “Start”. A “Select start-up disk” dialog appears – click the folder icon, browse to your Ubuntu ISO, select it, and click “Start”.
- Boot from ISO – The VM will boot from the ISO. You’ll see the Ubuntu installer menu. Choose “Try or Install Ubuntu” (or just “Install Ubuntu”).
- Run the Ubuntu Installer – Follow the on-screen prompts: choose your language, keyboard layout, and network (optional). When asked about updates, you can select “Normal installation” and “Download updates while installing” if you have internet.
- Installation Type – Choose “Erase disk and install Ubuntu” – this is safe because it only affects the virtual disk, not your real hard drive. Click “Install Now”, then confirm the partition changes.
- Set Your Account – Enter your name, computer name, username, and password. Choose whether to log in automatically or require a password. Click “Continue”.
- Wait for Installation – The installer copies files and installs the system. This takes 5–15 minutes depending on your hardware.
- Restart and Remove ISO – When prompted, click “Restart Now”. If the VM asks to remove the installation medium, press Enter. If it boots back into the ISO, shut down the VM (right-click the VM > Close > Power Off), then in Settings > Storage, remove the ISO from the optical drive (click the disk icon and choose “Remove disk from virtual drive”). Start the VM again.
- Install Guest Additions (Recommended) – After booting into Ubuntu, go to the VirtualBox menu “Devices” > “Insert Guest Additions CD image”. In Ubuntu, a prompt appears – click “Run”. Enter your password when asked. Guest Additions improves screen resolution, clipboard sharing, and drag-and-drop. Reboot the VM afterward.
Common Mistakes
- Not enough RAM allocated – If the VM runs extremely slowly or freezes, you likely gave it too little memory. Increase it in Settings, but leave enough for your host OS.
- Choosing the wrong ISO – Make sure you downloaded the 64-bit desktop ISO, not the server version or a 32-bit build (Ubuntu no longer offers 32-bit desktop).
- Forgetting to remove the ISO after install – The VM may boot from the ISO again instead of the hard disk. Remove the ISO from the virtual drive as described.
- Enabling 3D acceleration without Guest Additions – This can cause graphics glitches. Install Guest Additions first, or leave 3D off.
- Using a static virtual disk size – If you chose “Fixed size”, it will pre-allocate the full disk space, which can be slow to create and wastes space if you don’t need it.
Tips
- Use a fixed-size virtual disk if you have plenty of free space – it performs slightly better than dynamic.
- Enable “PAE/NX” in System > Processor if you have an older 32-bit guest (not needed for 64-bit Ubuntu).
- Set up a shared folder between host and guest: In VM Settings > Shared Folders, add a host folder, then in Ubuntu it appears under /media/sf_
(you may need to add your user to the “vboxsf” group). - Take snapshots before major system changes – right-click the VM, select “Snapshots”, and click “Take”. You can revert if something breaks.
- If your host has a solid-state drive, keep the VM on that drive for faster performance.
Troubleshooting
If the VM doesn’t start or shows an error, try these in order:
- Check virtualization is enabled – If you get a “VT-x is not available” error, restart your computer, enter BIOS/UEFI (usually by pressing F2, F10, Del, or Esc during boot), find “Intel VT-x” or “AMD-V” and enable it. Save and exit.
- Update VirtualBox – Older versions may have bugs. Download the latest version from virtualbox.org.
- Check host resources – Close other heavy applications. If your host is low on RAM, the VM may crash or be extremely slow.
- Reinstall Guest Additions – If drag-and-drop or clipboard sharing isn’t working, uninstall Guest Additions in Ubuntu (run the script in /opt/VBoxGuestAdditions-*/uninstall.sh), then reinstall from the CD image.
- If the screen is black after boot – Try disabling 3D acceleration in Display settings. If that doesn’t help, increase video memory to 128 MB.
- If the installer freezes – Try a different Ubuntu version (e.g., the previous LTS) or check the ISO’s checksum (see Ubuntu’s documentation).
Frequently Asked Questions
Can I run Ubuntu in VirtualBox on a Mac with Apple Silicon (M1/M2)?
VirtualBox currently does not support ARM-based Macs. Use UTM or VMware Fusion instead, and download the ARM64 version of Ubuntu.
How much RAM should I give the Ubuntu VM?
At least 2 GB, but 4 GB is recommended for a smooth experience. Leave at least 4 GB for your host OS if possible.
Can I use a USB drive inside the VM?
Yes. With the VM running, go to Devices > USB and select your USB device. You may need to install the VirtualBox Extension Pack for USB 2.0/3.0 support.
How do I copy files between my host and the Ubuntu VM?
Install Guest Additions, then enable drag-and-drop and shared clipboard in VM Settings > General > Advanced. Or set up a shared folder as described in Tips.
Can I resize the virtual disk after creation?
Yes, but it’s not trivial. You can use the command-line tool VBoxManage to increase the disk size, then resize the partition inside Ubuntu using GParted. It’s easier to create a new VM with a larger disk and migrate your data.
Is it safe to install Ubuntu in VirtualBox? Will it affect my real computer?
Yes, it’s completely safe. The VM runs in an isolated environment – the virtual hard disk is just a file on your host. Nothing outside the VM is changed.