In this article we will give you an instruction with step-by-step screenshots to show you how to install Ubuntu as a guest OS on VirtualBox.
VirtualBox is a free, open-source and cross-platform virtualization software that creates a virtual machine on top of your OS. This machine will have its own virtualized disk and access to a part of your system’s CPU and memory. When configuring a virtual machine, the user can specify how many CPU cores, and how much RAM and disk space should be devoted to the virtual machine.
Before starting, you need to download the Ubuntu .ISO file you want to install from the Ubuntu download page. Once you have the .ISO file downloaded, you can proceed to install Ubuntu to a VirtualBox virtual machine.
Setting up a Virtual Machine in VirtualBox
In order to create a new virtual machine for installing Ubuntu on VirtualBox, open VirtualBox and click “New”.
Enter a name for your virtual machine (e.g., Ubuntu), select “Linux” as the type, and select “Ubuntu (64-bit)” as the version.
Allocate RAM to the virtual machine. The memory size depends on your host machine memory size. As our physical machine used in this example has enough of RAM (32 GB), we’ll set 4 GB of RAM for a virtual machine to install Ubuntu on VirtualBox.
You can select any amount of memory you wish, but don’t add more than 50% of your total RAM.
Check the “Create a virtual hard disk now” option so we can later define our Ubuntu virtual hard disk size and click “Create” button.
Accept the default “VDI (VirtualBox Disk Image)” drive file type and click “Next” button.
Next, we’ll dynamically allocate storage on our physical disk. This option allows you to save space on your physical disk until the virtual disk grows to its maximum allocated size. Click “Next” button.
Set the virtual hard drive file location by clicking on the folder-shaped icon. The virtual hard drive is a section of your computer’s hard drive space which will be used to store your virtual machine.
Set the file size of the virtual disk: 20 GB or more.
Click “Create” to finish setting up your Ubuntu virtual machine on VirtualBox.
The wizard will close and back to VirtualBox Manager. Select your Virtual Machine and click “Start” button.
When you first start Ubuntu virtual machine with VirtualBox, you will need to select a start-up disk. Start this process by clicking the little folder icon.
You will need to find and select the Ubuntu image (installation ISO file) you want to install. Click the “Add” button to bring up a file dialog box. Use this file dialog box to find and select the Ubuntu image that you downloaded earlier.
Confirm your choice by clicking the “Choose” button.
With the Ubuntu ISO installation file selected, click the “Start” button.
Finally, we can install the Ubuntu operating system to our VirtualBox’s virtual machine. The virtual machine boots from the ISO Ubuntu installation image.
Install Ubuntu in VirtualBox
Things from here are Ubuntu-specific. To go ahead and install, click “Install Ubuntu“.
Choose your keyboard layout and click “Continue” button.
Typically you will want Ubuntu to be installed on your VirtualBox virtual machine as a “Normal installation“. Make sure “Download updates while installing Ubuntu” and “Install third-party software for graphics and Wi-Fi hardware and additional media formats” options are selected. This will ensure that everything Ubuntu needs to run will be installed.
Click “Continue” button.
Check “Erase disk and install Ubuntu” and hit the “Install Now” button.
Confirm by clicking on the “Continue” button.
With the correct time zone selected, click the “Continue” button.
The last thing we need to do is create an account. Enter your preferred name, username and password. Note that this user will have root/sudo privilege. Lastly, click the “Continue” button.
The installation will continue until it is finished.
You are almost done. Wait patiently for Ubuntu to be installed on VirtualBox. This process can take anywhere between a 5 and 10 minutes.
Once Ubuntu has finished installing itself, you will see a notification window. To proceed, click the “Restart Now” button.
Upon restarting, you will see a message about removing the installation medium. Just press the “Enter” key.
And that’s all. From now on, select your name, then enter your password and sign in to your newly installed Ubuntu on VirtualBox.
Ubuntu will load your desktop as though you were using a separate computer.
Installing VirtualBox Guest Additions on Ubuntu
VirtualBox Guest Additions is a set of drivers and system utilities intended to improve usability and virtual machine performance as well as tight integration with a host OS.
The VirtualBox Guest Additions offer the following features:
- Better video support
- Mouse pointer integration
- Shared clipboard
- Shared folders
- Drag and drop support
- Seamless windows
- Generic host/guest communication channels
- Better Time synchronization between guest and host
Just to clarify, you need to run these commands in the virtual Ubuntu system:
Update your Ubuntu guest operating system software packages:
sudo apt update sudo apt upgrade
Once upgrade completes, reboot your Ubuntu guest operating system and run:
sudo apt install build-essential dkms linux-headers-$(uname -r)
Next, from the Virtual Machine menu bar, go to “Devices” and click on “Insert Guest Additions CD image“. This helps to mount the Guest Additions ISO file inside your virtual machine.
You will get a dialog window, prompting you to “Run” the installer to launch it.
Enter your user’s password and click “Authenticate” button.
This should open up the installation in a terminal window. Once the installation is complete, just press the “Enter” key.
Finally, restart your system to reload kernel modules.
Now with Guest Additions installed, the clipboard of your guest OS can be shared with your host OS. To enable Shared Clipboard and Drag’n’Drop functionality, open VirtualBox Manager and click on “Settings“.
Next, go to “General” -> “Advanced” and enable the two options from the drop down menu.
VirtualBox is free and is a great tool for running multiple operating systems on a single OS. It is the easiest and safest way to install a “new computer” on your own machine with no risk.
Today’s article explained how to install Ubuntu on VirtualBox. If you encounter any issues with getting Ubuntu to install as a VirtualBox virtual machine, please feel free to ask your questions in the comment box below.