How to Install Ubuntu on VirtualBox: Detailed Overview

Whether you are looking to try out some software, prepare for migration to Linux from Windows or macOS, test applications, network, or otherwise, you need to install Ubuntu on VirtualBox . Installing Ubuntu on VirtualBox as a virtual machine (VM) has a lot of advantages – you can create a snapshot and roll back changes to the appropriate VM state if something goes wrong, clone a VM, copy a VM to another machine easily (all VM data is stored as a set of files), or run a VM on different host operating systems that are supported by VirtualBox.

This blog post explains how to install Ubuntu on VirtualBox. The operating system (OS) runs on a physical machine is referred to as a host OS, and the operating system run on a VM is called a guest OS (Ubuntu in this case). Make sure that VirtualBox is installed on your physical machine before proceeding.

NAKIVO for Linux Machines Backup

NAKIVO for Linux Machines Backup

Fast and efficient backup for Linux servers and workstations. Anti-ransomware protection, multiple backup targets, flexible recovery options and much more!

System Configuration of the Host Machine

In order to install Ubuntu on VirtualBox, you should have a physical computer with at least 4 GB of RAM (Random Access Memory), a hard disk drive with at least 30 GB of free space (SSD is preferred due to its higher performance). Your CPU (Central Processor Unit) must support Intel VT-x or AMD-v hardware virtualization features which must also be enabled in UEFI/BIOS. This point is especially important if you are looking for how to install Ubuntu 64-bit on VirtualBox.

Downloading the Installation Image

You need to download the Ubuntu distribution for installing Ubuntu on VirtualBox. Go to the official Ubuntu website and download the necessary version of the Ubuntu installer. Let’s download Ubuntu 18.04.2 LTS – this is the latest long term support (LTS) Ubuntu version available at this moment. You can find version numbers that are higher than 18.04.2, but they may not offer long term support yet. Five-year support is provided for Ubuntu LTS distributions (both Ubuntu Desktop and Ubuntu Server). Ubuntu LTS is more widely tested, enterprise-focused and compatible with new hardware.

Click the green Download button and save the ISO file to the custom location. In our case, the file name is ubuntu-18.04.2-desktop-amd64.iso. Ubuntu 18 is provided only as 64-bit editions.

How to install Ubuntu on VirtualBox – downloading the Ubuntu installation image

Creating a New VM

In order to create a new virtual machine for installing Ubuntu on VirtualBox, open VirtualBox and click New (Machine > New) or press Ctrl+N.

How to install Ubuntu on VirtualBox – creating a new VM in VirtualBox

In the Create Virtual Machine screen, set the options for a new VM. In our example of installing Ubuntu on VirtualBox, the new VM options are the following:

Name: Ubuntu18x64

Machine Folder: C:\Virtual\VirtualBox (try to use disk D, E or other non-system partitions if you have them).

Type: Linux

Version: Ubuntu (64-bit)

Memory size: Set at least 1 GB of RAM. As our physical machine used in this example has 16 GB of RAM, we can set 4 GB of RAM for a virtual machine to install Ubuntu on VirtualBox. You should leave enough memory for your host operating system to operate normally.

Select the Create a virtual hard disk now option.

Hit Create to continue.

How to install Ubuntu on VirtualBox – setting parameters for a new VM

On the next Create Virtual Hard Disk screen, set the virtual disk file location, for example,

C:\Virtual\VirtualBox\Ubuntu18x64\Ubuntu18x64.vdi

The file size of the virtual disk: 20 GB or more.

Hard disk file type: VDI (VirtualBox Disk Image). Let’s select the native VirtualBox virtual disk format.

Storage on physical hard disk: Dynamically allocated. This option allows you to save space on your physical disk until the virtual disk grows to its maximum allocated size.

Hit Create to finish creating a new VM to install Ubuntu on VirtualBox.

How to install Ubuntu on VirtualBox – creating a virtual disk for a new VM

VM Configuration

A new virtual machine to install Ubuntu on VirtualBox has now been created and its name is displayed in the list of VMs in the main VirtualBox window. You need to edit VM settings after VM creation. Select your new VM (Ubuntu18x64 in this case) and click Settings (Machine > Settings or press Ctrl+S).

How to install Ubuntu on VirtualBox – configuring VM settings after VM creation

In the Settings window, go to the Display section and select the Screen tab. Set video memory to 128 MB. Otherwise the Ubuntu installer may hang on some installation steps, keyboard may not response etc. You can enable 3D acceleration.

Hit OK to save settings.

How to install Ubuntu on VirtualBox – configuring video memory for the Ubuntu VM

Select the Boot Disk Image

You don’t need to burn the ISO image onto a DVD disk as you would for installing an operating system on a physical machine. You can mount the ISO image to the virtual DVD drive of the virtual machine and boot a VM from this media. Let’s insert the ubuntu-18.04.2-desktop-amd64.iso image that was downloaded from the official Ubuntu web site before, into a virtual DVD drive of the Ubuntu18x64 VM. Open your VM settings and go to the Storage section. Select your virtual controller used for connecting a virtual DVD drive (by default a virtual DVD drive is empty). Click the Empty status and in the right pane near the IDE Secondary Master, click the disc icon. In the menu that appears, click Choose Virtual Optical Disk File and browse your Ubuntu installation ISO image file (ubuntu-18.04.2-desktop-amd64.iso).

Hit OK to save settings. Now your VM is ready to install Ubuntu on VirtualBox.

How to install Ubuntu on VirtualBox – choosing a virtual optical disk file to boot the Ubuntu installer

How to Install Ubuntu on VirtualBox VMs

Once the new VM is prepared for installing Ubuntu on VirtualBox, start the VM (Machine > Start). The VM boots from the ISO Ubuntu installation image. The first screen that you can see after booting is the Welcome screen.

In the left pane select Language for displaying information in the installer interface. English is selected in the current example. Then click Install Ubuntu.

How to install Ubuntu on VirtualBox – installing Ubuntu on the VM

Keyboard layout. Choose your keyboard layout. Let’s select English (US).

How to install Ubuntu on VirtualBox – selecting the language during Ubuntu installation

Updates and other software. There are a few options to choose from on this screen.

Normal installation. A web browser, utilities, office applications and media players are installed.

Minimal installation. Only the main components including a web browser and basic utilities are installed.

Let’s select the normal installation.

Other options:

Download updates while installing Ubuntu. The Ubuntu team is always working towards making Linux better. That’s why after downloading the installer, some updates may be already available. You can automatically download and install updates right during Ubuntu installation, letting you save time after OS installation. Let’s select this option.

Install third-party software for graphics and Wi-Fi hardware and additional media formats. Tick this checkbox if you would like to install additional software, such as proprietary Wi-Fi drivers, video drivers, some TTF fonts etc.

How to install Ubuntu on VirtualBox – selecting Linux updates and other software

Installation type. This screen contains options for preparing a disk for Ubuntu installation.

Erase disk and install Ubuntu. This is the default option. All disk space will be automatically allocated to Ubuntu. If you select Erase disk and install Ubuntu on VirtualBox VMs, one big /dev/sda1 partition is created on /dev/sda. This /dev/sda1 partition with ext4 file system is mounted to the / directory (root directory), though a separate swap partition is not created. Attention: All data on the virtual disk will be erased—there is no reason to worry about it, however, because an empty virtual disk created previously is being used for installing Ubuntu on VirtualBox.

There are some additional options:

  • Encrypt the new Ubuntu installation for security.
  • Use LVM (Logical Volume Management) with the new Ubuntu installation.

Something else. Use this option for manual creation of the partition table on your virtual disk which is used to install Ubuntu on VirtualBox.

Click Install Now when you are ready to continue. Then on the confirmation screen, hit Continue.

How to install Ubuntu on VirtualBox – preparing a disk

Where are you? Select your location to set the time zone and regional settings. The time for your selected region will be set automatically. Let’s select London.

How to install Ubuntu on VirtualBox – selecting the time zone

Who are you? Enter your user name, computer’s name, and set the password. Select Require my password to log in for a higher level of security. In our example, the username is user1 and the computer’s name is ubuntu18-vm.

How to install Ubuntu on VirtualBox – setting up user credentials

As you can see, useful tips are displayed on the screen during the installation process.

How to install Ubuntu on VirtualBox – Ubuntu is installing

When installation is complete, you will see a notification window. You have to restart your VM with Ubuntu on VirtualBox.

How to install Ubuntu on VirtualBox – the VM must be restarted after Ubuntu installation

Now you can eject the Ubuntu installation ISO disk from the virtual CD/DVD drive of the VM.

Installing VirtualBox Guest Additions

One final step is left to complete installing Ubuntu on VirtualBox. After the operating system reboot, install VirtualBox Guest Additions, which is a set of drivers and system utilities intended to improve usability and VM performance as well as tight integration with a host OS.

In the VM window, go to Devices and hit Insert Guest Additions CD image. The ISO disc image that is located in the VirtualBox installation directory will be inserted into a virtual CD/DVD drive of the VM. After that, you can see a CD shortcut on the Ubuntu Desktop. The ISO disk contains autorun, and the Guest Additions installer can be started automatically. Just hit the Run button to start installing VirtualBox Guest Additions.

How to install Ubuntu on VirtualBox – installing VirtualBox Guest Additions

If you get the warning message “Please install the gcc make perl packages”, it means that you have to install these packages first and then install VirtualBox Guest Additions.

How to install Ubuntu on VirtualBox – some packages must be installed before installing Guest Additions

In order to install the necessary packages, execute the command:

sudo apt-get install build-essential gcc make perl dkms

You may need to type admin credentials when using sudo.

After that, reboot your Ubuntu VM:

init 6

After restarting the VM, open Linux terminal and go to the directory of the virtual CD with Guest Additions. In our case, the following command is used:

cd /media/user1/VBox_GAs_6.0.8/

Check the contents of the directory:

ls -al

Run the Linux installer of VirtualBox Guest Additions on your Ubuntu on VirtualBox manually:

sudo ./VBoxLinuxAdditions.run

How to install Ubuntu on VirtualBox – installing VirtualBox Guest Additions in the console

When the installation process is finished, verify whether VirtualBox Guest Additions have been installed successfully. Let’s check the appropriate kernel modules that are installed with Guest Additions:

lsmod | grep -I vbox

Check the module information:

modinfo vboxguest

You can check only version of VirtualBox Guest Additions:

lsmod | grep -io vboxguest | xargs modinfo | grep -iw version

How to install Ubuntu on VirtualBox – checking the version of VirtualBox Guest Additions installed on the Ubuntu VM

Conclusion

The installation process is not difficult – you should create a new VM, configure that VM, select a boot disk ISO image and boot from that installation image. Further installation process of Ubuntu on a VirtualBox VM is similar to installing Ubuntu on a physical machine. After installing Ubuntu on VirtualBox, don’t forget to install VirtualBox Guest Additions on a guest OS and VirtualBox Extension Pack on a host OS to unlock extra features, improve performance and user experience.

NAKIVO for VMware vSphere Backup

NAKIVO for VMware vSphere Backup

Complete data protection for VMware vSphere VMs and instant recovery options. Secure backup targets onsite, offsite and in the cloud. Anti-ransomware features.

People also read