Overview

This tutorial provides instructions for installing Ubuntu 20.04 LTS using VirtualBox.

Outcomes

  • Produce a working installation (virtual machine) of Ubuntu 20.04 LTS

Prerequisites

Important note

A note to ARM64 users

If you're using a machine with an ARM64 CPU (ex. a Mac M1), you won't be able to run VirtualBox. Windows users should install Ubuntu (either via VirtualBox or natively on a separate partition).

Background

This section provides a bit of background on the key technologies involved in this tutorial.

What's Linux?

Linux is a common core or kernel shared by a class of operating systems (OS). Commonly, however, people simply use Linux to refer to operating systems that use the Linux kernel.

History/Lineage

Linux was developed by Linus Torvalds in the 1990s as an extension to the GNU operating system (which in turn was a rewrite of AT&T's Unix OS).

What's VirtualBox?

VirtualBox is a free, cross-platform (AMD64 CPUs running MacOS, Windows, Linux, etc.) application for software virtualization that allows you to run multiple guest operating systems (virtual machines) at the same time on a single host OS (the OS of the physical machine on which VirtualBox is running). If something goes wrong with a virtual machine (for example, perhaps you're experimenting with a completely new OS), you can safely delete or replace it without damaging your host OS.

Why use Linux?

Why is this necessary?

Many of the tools we will use were developed on Linux-based OS. This course uses a Linux-based development environment. For the sake of uniformity, we'll be using Ubuntu 20.04 LTS which is a Debian-based Linux distribution.

Prerequisites

Before starting, ensure that ...

  • you have a machine with at least 8GB of RAM and 50GB of free space

Part 1: Installing VirtualBox

Follow this link and install VirtualBox according to the instructions provided for your operating system (OS).

Checking the version of VirtualBox

  1. Click VirtualBox About VirtualBox

virtualbox-home

  1. You can check the version in the window that launches.

virtualbox-version

Part 2: Downloading Ubuntu 20.4 LTS

  1. Open the Ubuntu Desktop home page in your computer's web browser. You can download the Ubuntu disk image (also known as an ISO file) here. Alternatively, you can use this link:
  1. After confirming that the version of your ISO file is 20.04 (Ubuntu 20.04 LTS), click Download.

ubuntu-download

Part 3: Creating a virtual machine (VM) using VirtualBox

  1. Open VirtualBox (instructions vary depending on your host OS).
  2. Click the blue badge in the upper-left corner on the VirtualBox window labeled New.

new-buttonon-vm

  1. Enter a name for your virtual machine. Since we're installing Ubuntu 20.04, I'll enter 'ubuntu2004'. Note that VirtualBox automatically changes Type to Linux and Version to Ubuntu (64 bit). These two options are what we need, so keep those settings. Click Continue.

vm-name-and-os

  1. Select the amount of RAM to use for the virtual machine (VM). Click and drag the slider left or right to decrease or increase the amount of RAM that VirtualBox will make available to your Ubuntu VM. Click Continue.
  • The "ideal" amount of RAM will automatically be selected when you get to this page.
  • Make sure not to increase the RAM into the red section of the slider, as performance is likely to be adversely affected; try to keep the slider in the green.

vm-memory-size
Try to allocate at least 4GB of RAM to your VM

  1. Accept the default Create a virtual hard drive now and click Create.

vm-create-hard-disk

  1. Continue to accept the default option of VDI drive file type and click Continue .

vm-hard-disk-file-type

  1. Accept the default Dynamically allocated and click Continue.

vm-strage

  1. Specify a maximum virtual drive size and click Create.

vm-file-location-size

I recommend at least 40 GB

Part 4: Installing Ubuntu in VirtualBox

Now that the virtual machine has been created, we are ready to install Ubuntu in this VM.

  1. Select your new VM created in Part 3 and click Settings .

virtualbox-setting

  1. Click on Storage category (1 in the image) and then Empty under Controller:IDE (2 in the image). Click the "CD/DVD" icon (3 in the image) on the right hand side and select the Ubuntu ISO file to mount.

virtualbox-strage

  1. Select the location of the Ubuntu ISO file that you downloaded in Part 2, and click Open.

ubuntu-iso-location

  1. Check the Location field and make sure that the correct ISO file is selected, then click Ok.

virtualbox-iso-file

  1. From the Oracle VM VirtualBox Manager, click on the new Ubuntu virtual machine and click on the Start button.

vm-start

  1. When the dialog box appears, click Start. Note that the installation process that follows may differ a little from version to version. The screenshots here are based on Ubuntu 20.04.

ubuntu-start

  1. Click Install, and follow the steps.

ubuntu-welcome-page

ubuntu-keyboard-layout

ubuntu-updates

Make sure the Erase disk and install Ubuntu option is selected and click the Install Now button. This may sound scary, but nothing on your computer will be erased.

ubuntu-installation-type

Click Continue .

ubuntu-installation

ubuntu-timezone

  1. In the Who are you? dialog, enter your preferred name, username, and password. Note that this user will have root/sudo privilege. Click the Continue button.

ubuntu-acount-setting

  1. Wait until the installation is finished. After the installation is complete, click the Restart now button.

vm-restart-now

  1. When you see a screen with a black background saying Please remove installation medium, then press ENTER:, simply hit the ENTER key.

vm-black-background

  1. To log in, enter the password you chose earlier and press ENTER .

vm-login

Your Ubuntu Desktop installation is ready. Congratulations!

Part 5: Installing Guest Additions

This step is optional but highly recommended.

Guest Additions extend the capabilities of VirtualBox in several useful ways, including ...

  • enabling bidirectional host guest copy / paste support
  • sharing folders across host and guest systems
  • dragging and dropping files between host and guest
  • graphics improvements
    • higher resolutions
    • full screen
    • app windows
  • improved mouse integration

1. Install required packages

Open the terminal and run the following command:

If you are not sure how to open the terminal, please refer to the FAQ below.

$ sudo apt install linux-headers-$(uname -r) build-essential dkms

2. Install Guest Additions

In order to install VirtualBox Guest Additions on your Ubuntu VM, use the menu to select Devices Insert Guest Additions CD image. vm-guest-additions-cd-image

As soon as you attach the Guest Additions image to the VM, you will get a prompt to run the automatic installation. Click Run.

vm-guest-additions-click-run

Press Return key to complete the installation.

vm-guest-additions-complete.png

Reboot your system. You may need to enter your password in order to restart the VM.

$ sudo reboot

FAQ

How do I open the terminal?

Open the activity menu and type terminal and hit Enter key (or select the terminal icon).

faq-terminal

How do I copy and paste in Ubuntu?

The keyboard shortcuts for copying and pasting differ depending on whether there are executed within the terminal elsewhere.

Terminal

To copy text from the terminal/CLI prompt, use SHIFT+Ctrl+c. To past into the terminal, use SHIFT+Ctrl+v

Everywhere else

To copy text elsewhere (VM's web browser, code editor, etc.), use Ctrl+c

To paste text anywhere other than the terminal, use Ctrl+v.

How do I copy and paste from host to guest and guest to host?

To enable bidirectional copy / paste, you must first install Guest Additions. From the VM menu, navigate to Settings General Advanced and select Bidirectional from the Shared Clipboard dropdown.

setting-shared-clipboard.png

How do I restart a VM?

If your VM is unresponsive, you can force it to reset by right-clicking the entry for the VM in left pane of the VirtualBox window and selecting Restart.

faq-reset

Warning: From your VM's perspective, this is equivalent to unplugging the power from your computer.

How do I shut down a VM?

If you are running an Ubuntu 20.04 VM, click the power icon in the upper righthand corner of your screen and select Power Off / Log Out Power Off....

faq-shutdown

Next Steps

For an introduction to the Linux command line, see this tutorial.

cd ~/Creative Commons License