Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 1f

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox

For a TypeScript training, I needed an environment with Visual Studio Code and Node.js (a JavaScript runtime).

On my Windows laptop, I wanted to create an environment with Ubuntu as guest Operating System, Visual Studio Code and Node.js available within an Oracle VirtualBox appliance.

In this article, I will share with you the steps I took, to get this working within an Oracle VirtualBox appliance. In this article the focus will be on manually installing Ubuntu Desktop.

In a later article I will describe, as an alternative, installing Ubuntu Desktop with the help of Vagrant, including Visual Studio Code and Node.js.

Visual Studio Code

Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages and runtimes (such as C++, C#, Java, Python, PHP, Go, .NET).
[https://code.visualstudio.com/docs]

Node.js

As an asynchronous event-driven JavaScript runtime, Node.js is designed to build scalable network applications
[https://nodejs.org/en/]

Manually installing Ubuntu Desktop

For installing Ubuntu Desktop using VirtualBox, I followed the instructions “How to run Ubuntu Desktop on a virtual machine using VirtualBox”:

https://ubuntu.com/tutorials/how-to-run-ubuntu-desktop-on-a-virtual-machine-using-virtualbox#1-overview

Next, I will describe these installation steps. Because not everything went according to plan. Among others, I also had a look at “How to Install Ubuntu 22.04 LTS Linux on VirtualBox using Windows 10” via https://www.youtube.com/watch?v=zHwFtyxJsog, which was very helpful.

Download an Ubuntu Image

I downloaded Ubuntu 22.04 LTS (ubuntu-22.04-desktop-amd64.iso (3,40 GB)), the latest LTS version of Ubuntu, for desktop PCs and laptops. LTS stands for long-term support — which means five years, until April 2027, of free security and maintenance updates, guaranteed.

Recommended system requirements:

  • 2 GHz dual-core processor or better
  • 4 GB system memory
  • 25 GB of free hard drive space
  • Internet access is helpful
  • Either a DVD drive or a USB port for the installer media

[https://ubuntu.com/download/desktop]

Download and install VirtualBox

I already had VirtualBox on my Windows laptop. I upgraded the version to:
Version 6.1.36 r152435 (Qt5.6.2)

Create a new virtual machine

I created a new virtual machine, with the following details:

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 2

On the next screen, I selected the amount of RAM from my Windows laptop that the virtual machine will access, taking into account the recommended system requirements for Ubuntu Desktop.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 3

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

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 4

The type of hard disk depends on whether you use VirtualBox with other VM software. I kept this as a VDI.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 5

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. I kept it as dynamically allocated.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 6

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

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 7

I selected 25 GB, taking into account the recommended system requirements for Ubuntu Desktop.

After this I clicked the ‘Create’ button to initialize the machine.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 8

Before starting the appliance, via Settings | System | Processor, I changed the number of CPUs to 2.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 9

Install your image

Click the ‘Start’ button 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.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 10

Next, choose ‘Install Ubuntu’.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 11

Ubuntu Desktop should now boot and display the installation menu.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 12

Because I was following the instructions “How to run Ubuntu Desktop on a virtual machine using VirtualBox”, the next step was to change the window resolution first.

Changing the window resolution (by using VBoxSVGA)

I did follow these instructions, but in the end got in to trouble, because after the installation and reboot the login screen did not appear.

You’ll notice that by default VirtualBox only displays at 800×600 resolution. But if you right click the ‘Window in monitor’ icon at the bottom of the screen (or via the menu: View) and select ‘Virtual Screen 1’, there are many more options available, but greyed out.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 13

According to the instructions, to resolve this, I needed to change some settings. I closed the window and selected ‘Power off the machine’ (via the menu: File | Close | Power off the machine).

I returned to the Oracle VM VirtualBox Manager window and selected ‘Settings’. Then navigated to the Display tab. Changed the Graphics Controller setting to ‘VBoxSVGA’ and clicked OK (ignoring the warning).

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 14

Next, I started my virtual machine.

Once Ubuntu has started, you should now be able to select all of the available resolutions from the ‘Virtual Screen 1’ menu, or simply resize the window to adjust the display.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 15

As I mentioned before, I did follow the instructions, but in the end got in to trouble, because after the installation (these same installation steps are described later on in this article) and a reboot, the login screen did not appear.

So, I opted for another way of doing things.

I selected ‘Power off the machine’ (via the menu: File | Close | Power off the machine).

I returned to the Oracle VM VirtualBox Manager window and selected ‘Settings’. Then navigated to the Display tab. Changed the Graphics Controller back to ‘VMSVGA’.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 16

Then I navigated to the System tab, selected ‘Enable EFI’ and clicked OK.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 17

Remark about Enable EFI:
Enables Extensible Firmware Interface (EFI), which replaces the legacy BIOS and may be useful for certain advanced use cases. See Section 3.14, “Alternative Firmware (EFI)”
[https://www.virtualbox.org/manual/ch03.html#settings-system]

Next, I started my virtual machine.

Continuing the installation of Ubuntu Desktop

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 18

In the “Welcome” window, the preferred language ‘English’ is selected.
To install Ubuntu, I clicked on the ‘Install Ubuntu’ button.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 19

In the “Keyboard layout” window, as the preferred keyboard layout, ‘English (US)’ is selected.
Next, I clicked on the ‘Continue’ button.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 20

In the “Updates and other software” window, I kept the defaults: ‘Normal installation’ and ‘Download updates while installing Ubuntu’.

The minimal installation is useful for those with smaller hard drives or who don’t require as many pre-installed applications.

In Other options, you will be prompted to download updates as well as third-party software that may improve device support and performance (for example, Nvidia graphics drivers) during the installation. It is recommended to check both of these boxes.

If you are not currently connected to the internet, you will be prompted to do so at this point. Ensure you are able to remain connected throughout the installation.
[https://ubuntu.com/tutorials/install-ubuntu-desktop#5-installation-setup]

I also selected the ‘Install third-party software’ option.

Next, I clicked on the ‘Continue’ button.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 21

In the “Installation type” window, I kept the default: ‘Erase Disk and install Ubuntu’.
Next, I clicked on the ‘Install Now’ button.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 22

In the “Write the changes to disks?” pop-up window, I clicked on the ‘Continue’ button.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 23

In the “Where are you?” window, I selected my location and timezone from the map screen and clicked on the ‘Continue’ button. This information will be detected automatically if you are connected to the internet.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 24

In the “Who are you?” window, I filled in the fields and clicked on the ‘Continue’ button.

On this screen, you will be prompted to enter your name and the name of your computer as it will appear on the network. Finally, you will create a username and a strong password.

You can choose to log in automatically or require a password. If you are using your device whilst travelling, it’s recommended to keep automatic login disabled.
[https://ubuntu.com/tutorials/install-ubuntu-desktop#9-create-your-login-details]

After that, the installation process starts.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 25

At the end of the installation process, you have to restart the computer. I clicked on the ‘Restart Now’ button.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 26

When you restart, you will be prompted to remove your installation medium from the device.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 27

However, you don’t have to remove the installation medium and can immediately press ENTER.

Next, enter your password on the login screen (assuming you selected that option when creating your login details).

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 28

Next, I had to step through some welcome screens.
I mostly used the ‘Skip’ or ‘Next’ button.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 29

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 30

Here, I chose not to send system info.

Then a pop-up appeared concerning updated software:

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 31

I clicked on the ‘Install Now’ button.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 32

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 33

After a while the updates were installed and in the final pop-up, I clicked on the ‘Restart Now’ button.

Again, I had to enter my password on the login screen.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 34

And again, I had to step through some welcome screens.
I mostly used the ‘Skip’ or ‘Next’ button.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 35

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 36

I clicked on the ‘Next’ button, skipping the set up of Livepatch.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 37

Again, I chose not to send system info.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 38

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 39

Finally, I clicked on the ‘Done’ button.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 40

A few more things had to be done. But first, I moved the ‘Home’ folder to another position on the desktop.

Display Settings

I right clicked on the dashboard and choose ‘Display Settings’.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 41

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 42

I changed the default resolution from “1024 x 768” to something more suitable for my Windows laptop.

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.
[https://ubuntu.com/tutorials/how-to-run-ubuntu-desktop-on-a-virtual-machine-using-virtualbox#5-installing-guest-additions]

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 43

From the VirtualBox menu, I selected Devices | Insert Guest Additions CD image.

Then you will notice on the left-hand side, that a VBox_GAs_6.1.36 image appears.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 44

I clicked on the icon to show it’s content.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 45

I right clicked on file autorun.sh and chose ‘Run as a program’. Next, I entered my password.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 46

After that, the VirtualBox Guest Additions installation started.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 47

Checking the results above, you can see the following error occurred:

“This system is currently not set up to build kernel modules”.

In order to fix this, I followed the instructions from “How to Install Ubuntu 22.04 LTS Linux on VirtualBox using Windows 10”. I opened a terminal (via Activities):

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 48

In the search field I typed: terminal

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 49

I clicked on the ‘Terminal’ icon and then I used the following command:

sudo apt update

With the following output:

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 50

Next, I used the following command:

sudo apt install build-essential

Remark about build-essential:
This package contains an informational list of packages which are considered essential for building Debian packages.
[https://packages.debian.org/sid/build-essential]

With the following output:

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 51

After I entered Y, the script continued.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 52

Then I repeated the previous steps, starting with a right click on file autorun.sh and choosing ‘Run as a program’, etc.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 53

Checking the results above, you can see, this time it worked. I closed the window by pressing Return.

And I closed the system, via the VirtualBox menu, File | Close | Save the machine state.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 54

Next, I started my virtual machine and entered my password on the login screen.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 55

From the VirtualBox menu, I selected View | Auto-resize Guest Display.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 56

This nicely resized the display.

Next, from the VirtualBox menu, I selected Devices | Shared Clipboard | Bidirectional.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 57

Remark about Shared Clipboard:
You can select here whether the clipboard of the guest OS should be shared with that of your host. If you select Bidirectional, then Oracle VM VirtualBox will always make sure that both clipboards contain the same data. If you select Host to Guest or Guest to Host, then Oracle VM VirtualBox will only ever copy clipboard data in one direction.
[https://www.virtualbox.org/manual/ch03.html#generalsettings]

Next, from the VirtualBox menu, I selected Devices | Drag and Drop | Bidirectional.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 58

Remark about Drag and Drop:
This setting enables support for drag and drop. Select an object, such as a file, from the host or guest and directly copy or open it on the guest or host. Multiple drag and drop modes for a VM enable restricting of access in either direction.
[https://www.virtualbox.org/manual/ch03.html#generalsettings]

Finally, I closed the system, via the VirtualBox menu, File | Close | Save the machine state.

Installing Ubuntu Desktop 22.04 LTS on a virtual machine using VirtualBox lameriks 2022 08 59

So now, on my Windows laptop, I had an environment with Ubuntu Desktop, available within an Oracle VirtualBox appliance. This environment gave me a basis for installing other software (like Visual Studio Code and Node.js), I needed for the TypeScript training.

In this article, I shared with you the steps I took, to get this working.

In a later article I will describe, as an alternative, installing Ubuntu Desktop with the help of Vagrant, including Visual Studio Code and Node.js.

2 Comments

  1. Emanuel Oliveira August 3, 2022
  2. Maarten August 3, 2022

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.