Your submission was sent successfully! Close

How to run Ubuntu Desktop on a virtual machine using VirtualBox

1. Overview

In this tutorial, we’ll walk you through one of the easiest ways to try out Ubuntu Desktop on a virtual machine. VirtualBox is a general purpose virtualiser that is available across Linux, Mac OS and Windows. It’s a great way to experience Ubuntu regardless of your current operating system.

We will cover the fastest way to get started with VirtualBox, followed by some more advanced configuration options.

Note: This tutorial will also work for other distributions, so try it out with some of the Ubuntu flavours as well!

What you’ll learn

  • How to install and configure VirtualBox
  • How to import an Ubuntu image
  • How to run a virtual instance of Ubuntu Desktop
  • Further configuration options

What you’ll need

  • A PC with internet access!

Download an Ubuntu Image

Duration: 3:00

You can download an Ubuntu image here. Make sure to save it to a memorable location on your PC! For this tutorial, we will use the Ubuntu 20.04 LTS release.

Download and install VirtualBox

Duration: 5:00

On Mac OS or Windows you can download VirtualBox from the downloads page here.

This page also includes instructions to download VirtualBox for Linux. However, on Ubuntu, you can find VirtualBox by simply searching for it in the Ubuntu Software app.

Once you have completed the installation, go ahead and run VirtualBox.

2. Create a new virtual machine

Click New to create a new virtual machine. Fill in the appropriate details:

  • Name: If you include the word Ubuntu in your name the Type and Version will auto-update.
  • Machine Folder: This is where your virtual machines will be stored so you can resume working on them whenever you like.
  • Type: Linux
  • Version: Ubuntu (64-bit)

On the next screen, you will be able to select the amount of RAM from your main PC that the virtual machine will access. Be sure to remain inside the green bar to ensure you can continue to work outside of the VM whilst it’s running!

Note: If you select Expert Mode, you will be given the option to set all of these parameters in one go. Useful for future setups!

It’s fine to use the default settings for now.

After that, you can select how much of your hard disk your VM will use.

The type of hard disk depends on whether you use VirtualBox with other VM software. For now, we can leave this as a VDI.

Then you can choose whether the hard disk is dynamically allocated (up to the limit we will set on the next screen), filling up as the VM requires it. Otherwise, we can tell it to allocate the full amount of memory right from the start. This will improve performance but may take up unnecessary space. We’ll leave it as dynamically allocated for this tutorial.

Finally you can set the maximum amount of memory your VM can access.

After this click Create to initialize the machine!

3. Install your image

Click Start to launch the virtual machine. You will be prompted to select the start-up disk. Use the file icon to open the Optical disc selector and click Add to find your .iso file

Choose the disc image you want to use, then click Start on the start-up disc window.

Note: If you close this window before selecting an image you can still do so from the Devices menu at the top of the VM window. Select Devices > Optical Drives > Choose/Create a disc image…

Ubuntu desktop should now boot and display the installation menu.

After this point you can follow the normal installation flow for Ubuntu Desktop.

But there’s one more thing to talk about before we move on!

4. Changing the window resolution

You’ll notice that by default VirtualBox only displays at 800x600 resolution. But if you right click the Window in monitor icon at the bottom of the screen and select Virtual Screen 1, there are many more options available, but greyed out.

To resolve this we need to change some settings. Close the window and select Power off the machine.

Return to the manager window and select Settings.

Then navigate to the Display tab.

Change the Graphics Controller setting to VBoxSVGA and click OK (ignore the warning).

Now restart your virtual machine.

Once Ubuntu has started, you should now be able to select all of the available resolutions from the virtual monitor menu, or simply resize the window to adjust the display.

That’s the end of the primary tutorial. Congratulations, you now have Ubuntu running on a virtual machine!

What follows are some more advanced options if you’d like to explore VirtualBox further.

5. Installing Guest Additions

Guest Additions is an extra piece of software that unlocks some more advanced features of VirtualBox. This includes better integration between your virtual machine and the host machine, as well as improved video support that enables the display resolution options when using VMSVGA.

To install Guest Additions, you need to complete your installation of Ubuntu in your virtual machine and boot to the desktop.

From there, select Devices > Insert Guest Additions CD.

This will prompt you to download the Guest Additions disk image file.

Click Download.

Then click Insert.

The disc will appear inside your virtual desktop and you will be prompted to run the software.

Enter your password to install it.

Once this is complete, you will need to restart your virtual machine for the new features to take effect.

Close the machine, but before you start it up again, return to the Settings menu and change the Graphics Controller back to VMSVGA and Enable 3D Acceleration. This will improve the performance of your virtual machine by taking advantage of your PC’s 3D hardware and allow you to resize your desktop resolution!

Another feature this unlocks is the shared clipboard, which you can activate in Devices > Shared Clipboard. This will allow you to copy and paste between your virtual and host machines, useful when you want to copy outputs from one device to the other.

6. Explore Virtual Box

As you can probably tell, there are tonnes of further configuration options available in VirtualBox and we’ve only scratched the surface.

VirtualBox allows you to create and configure multiple virtual machines, so don’t be afraid to create new instances of Ubuntu to try out different system and storage configurations to fine tune your performance.

Why not try following the tutorial above with one of the Ubuntu flavours!

7. Tell us your thoughts!

Thank you for following this tutorial, we’d love to hear how you got on.

Give us feedback in the Ubuntu Discourse if you have any issues.

To help us improve our tutorials, we’d love to hear more about you:

How will you use this tutorial?

What is your current level of experience?

What operating system are you following this tutorial on?