Install Ubuntu on a Virtual Machine in a few simple steps and start using Linux right away.

by Mayank
Featured

There are a variety of reasons why you would want to start using Linux as your primary operating system, including course requirements at university, the ability to deploy a local server using Apache on Linux, and learning shell scripting.

A user switching from Windows or MacOS to Linux can find the transition difficult due to the fact that Linux may not support most of your daily used applications, such as the Microsoft Office suite, or most of your favorite games.

As a result, you might want to give Linux a try for a few months before deciding whether to make it your primary operating system. If you are one of these people, I would suggest that before fully removing Windows from your PC and installing a Linux distribution, you must experiment with Linux in a virtual machine to become acquainted with the environment.

Click here for a detailed guide on how to fully uninstall Windows and install Linux, or how to dual-boot your computer with Linux and Windows.

What is a Virtual Machine?

A virtual machine is basically an emulation or virtualization of an operating system. This means that you are effectively running another operating system on your primary operating system through virtualization software. The virtualized or emulated operating system is referred to as the “Guest OS,” and the main operating system on your machine is referred to as the “Host OS.”

The guest OS will have complete access to your I/O devices, memory, and CPU, allowing you to use another operating system without having to remove your primary oprating system from your PC.

The key advantage of installing Ubuntu (or any other Linux distribution) on a virtual machine is that if you break something inside Ubuntu, it will not affect or harm Windows or your files and folders within Windows.

There are several free applications for Windows that can be used to create a Virtual Machine. Most people I know who are new to Linux use VirtualBox because the interface is really simple.

In this post, I’ll guide you through the process of installing and running Ubuntu (the most popular distribution on personal computers) on a virtual machine created with VirtualBox.

Initial Steps

  • Download the latest VirtualBox application for your PC.

Open the link below and click on Windows hosts under the section “VirtualBox 6.1.22 platform packages” (Refer to the picture):

https://www.virtualbox.org/wiki/Downloads

Download VirtualBox
  • Let the download finish and launch the setup wizard from your Downloads folder. Allow all the prompts generated by the application to finish the installation.
  • You have successfully installed VirtualBox on your PC. Now you need to download the Ubuntu OS itself. Click on the link below to download an Ubuntu image file from the official site.

https://ubuntu.com/download/desktop

Download Ubuntu

You can download either the 20.04 LTS version or the 21.04 yearly version.

I’d highly recommend that you download the LTS (Long-term support) version since it has 5 years of support including security and maintenance upgrades.

Wait for the download to finish as it may take some time depending on your internet speed
  • Once the Ubuntu image file is successfully downloaded, launch VirtualBox and click on New.
Create a new VM
  • Name your VM as you like and then select Type as Linux and Version as Ubuntu (64-bit) and click on Next.
Enter the name of your VM
  • Now you need to allocate memory out of your installed RAM to the virtual machine. The system I am using has 8GB of RAM installed so I am allocating 4GB to the VM.

NOTE: Remember that offering too much RAM to your VM can induce slowdowns in your host OS (Windows) while your VM is running.

Allocate RAM to your VM

Once you’re done, click Next.

  • After you’ve allocated memory to your VM, you’ll need to allocate space for your hard disk.

A virtual disk drive serves as a storage medium for your VM (Ubuntu), where you will install and store various files and folders when working with Ubuntu.

Verify that you have Create a virtual hard disk now selected, then click Create.

Create a new virtual hard disk
  • Select Hard disk file type as VDI (VirtualBox Disk Image) and click Next.
  • Select the storage as Dynamically allocated and click Next.
Select Dynamically allocated

Dynamic allocation has an advantage over fixed size virtual disk in that your virtual hard size will automatically grow as you store more and more files on it, so any extra space on your physical hard drive will not be wasted.

  • Select a hard disk size for your VM. You should allocate at least 50GB. Remember that you are only selecting the maximum size; this does not imply that the virtual hard disk will take up 50GB of your physical hard drive.

You have successfully created your VM and now you just need to install Ubuntu on it.

Installing Ubuntu on your VM

  • Click on Settings and then click on Storage. Under the section Controller: IDE, click on Empty.
Click on Empty
  • Now click on the little disk icon near the Optical Drive menu and click on Choose a disk file. You have to now find and select the Ubuntu image you downloaded earlier.
Mounting Ubuntu image file as a boot device
  • Once you have selected the image file, click OK.
After selecting the Ubuntu ISO file, it should like this. Click OK to save your changes.
  • For installing Ubuntu, click on Start to launch your VM.
Always click on Start to launch your VM
  • You will be asked to select your boot drive, click on the drop-down and select your Ubuntu image file and hit Start.
Select primary boot device
  • Allow the disk check process to complete.
Allow the disk checking to finish.
  • You should be greeted with Ubuntu’s Startup Screen. Here you have to select the setup language from the left menu and click on Install Ubuntu.
Click Install Ubuntu
  • Now choose your Keyboard Layout and click Continue.
Select Keyboard Layout
  • Click on Normal Installation. Check the box Install third-party software and if you have an internet connection at the time of installing then Check Download Updates while installing Ubuntu. You can also download the updates after installation.
Select Normal installation
  • Now the Partition Menu will appear. Choose Erase Disk And Install Ubuntu. If you want to partition Ubuntu yourself, click on Something Else. Learn more about manual partitioning here.
Erase disk and install Ubuntu
  • Click Install Now and select Continue in the Dialog Box.
Click Continue to begin the installation
  • Select your Region and click Continue.
Select your Region
  • Enter your preferred Username and Password. Click Continue.
Setting a strong password is important to keep Ubuntu secure. This will ensure that no one but you will have the root access to your OS.
  • Ubuntu will now start installing. Wait for it to finish.
Grab a cup of coffee as this may take a while
  • When the installation finishes, the setup will ask you for a Restart. Click Restart Now.
Click Restart Now to restart your VM
  • You should now be greeted by the lock screen. Click on your username, enter your password and hit Enter.
The default lockscreen on Ubuntu 20.04 LTS
  • You can connect your online accounts via the next menu, or you can skip.
Connect your online accounts
  • Skip setting Livepatch for now.
  • Select Yes, send system info to Canonical and click Next.
Allow sending reports to developers to help improve your user experience
  • Click Done and you will have the GNOME desktop staring at you.
Welcome to the world of Linux!

Explore Ubuntu and Linux. Look through some Ubuntu resources online to quickly get acquainted with the GUI.

Bonus

If you have an old PC and are facing lags on your VM, you can raise the amount of CPU cores assigned to your VM to boost performance.

Here is how you can do this:

NOTE: Make sure your Ubuntu VM is not running as you do this.

  • Click on Settings and then click System.
Click System under the Settings menu
  • Under the Processor section, drag the slider to increase the number of CPU cores. Make sure the slider stays inside the green line.
Increase the number of CPU cores allocated to your VM
  • Click OK and start your VM. You should now see a significant improvement in performance.

Were you able to successfully install Ubuntu on your VM? If you run into any problems while following the instructions, please leave a comment below.

Related Posts

Leave a Comment