July 9, 2019
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.
Today’s 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.
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.
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.
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:
Machine Folder: C:\Virtual\VirtualBox (try to use disk D, E or other non-system partitions if you have them).
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.
On the next Create Virtual Hard Disk screen, set the virtual disk file location, for example,
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.
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).
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.
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 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.
Keyboard layout. Choose your keyboard layout. Let’s select English (US).
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.
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.
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.
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.
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.
As you can see, useful tips are displayed on the screen during the installation process.
When installation is complete, you will see a notification window. You have to restart your VM with Ubuntu on VirtualBox.
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.
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.
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:
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:
Check the contents of the directory:
Run the Linux installer of VirtualBox Guest Additions on your Ubuntu on VirtualBox manually:
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:
You can check only version of VirtualBox Guest Additions:
lsmod | grep -io vboxguest | xargs modinfo | grep -iw version
Now you know how to install Ubuntu on VirtualBox. It is also recommended that you install VirtualBox Extension Pack onto your host machine. Read also our blog post on how to use VirtualBox and configure shared folders, shared clipboard, create snapshots etc.
Today’s blog post explained how to install Ubuntu on VirtualBox. This 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.