Linux Virtual Machine (Latest Ubuntu Desktop 20.04) on Windows 10 Home with Virtual Box | Year 2021



Complete video tutorial to create Linux VM on Windows 10 Home PC (Without Hyper-V)
– Virtual Box VM
– Fix Screen Resolution
– Enable Copy and Paste b/w Host and VM
– Ubuntu Desktop 20.04 (latest 2021)
– Configure/Troubleshoot SSH
– SSH with Private Key
– Install Visual Studio Code (VS Code) on Linux desktop

Commands and Instructions –
I have created this tutorial on an HP Envy Windows 10 Home PC without Hyper-V, also I have enabled Virtualization under BIOS settings this is required for Oracle Virtual Box to work. More details can be found below.

For this tutorial we will use Oracle Virtual Box. You can find more details on virtual box in the blog link below

How to Use VirtualBox: Quick Overview

Step 1 :
Enable CPU virtualization features
First, you need to enable hardware virtualization features on your CPU (Central Processor Unit) such as Intel VT-X or AMD-V in UEFI/BIOS of your physical computer. Otherwise, if you run 64-bit guest operating systems, you can get the error: VT-x is not available. If Hyper-V is installed on your Windows machine, uninstall Hyper-V before installing VirtualBox (otherwise Hyper-V will block hardware virtualization extensions needed by VirtualBox to run VMs). The majority of modern processors support hardware virtualization.

Following link explains how you can enable hardware virtualization on your PC
https://2nwiki.2n.cz/pages/viewpage.action?pageId=75202968

Next Download Virtual Box
https://www.virtualbox.org/wiki/Downloads

Install Virtual Box, this is a simple installation, check out blog link below for more details –

How to Install Oracle VM VirtualBox on Windows 10

Step 2 :
Download latest Official Ubuntu Desktop 20.04 iso file
https://ubuntu.com/download/desktop

Step 3 :
Virtual Box : Create a New Virtual Machine
– Linux
– Ubuntu 64 bit

Step 4 :
Install Ubuntu Server / Desktop from iso file

Make sure ubuntu-desktop is updated
“`
sudo apt-get update
sudo apt-get upgrade
“`

Step 5 :
Enable Copy and Paste inside Ubuntu VM by installing the Guest Additions (works on Ubuntu Desktop)

On VM Window click Devices | Insert Guest Additions CD Image

Mount the CD-ROM with the command
“`
sudo mount /dev/cdrom /mnt
“`

cd into /mnt directory
“`
cd /mnt
“`

Ubuntu-Desktop command to install the necessary dependencies
“`
sudo apt-get install -y dkms build-essential linux-headers-generic linux-headers-$(uname -r)
“`

Run following command to run as root user
“`
sudo su
“`

Trigger VBoxLinuxAdditions.run file
“`
./VBoxLinuxAdditions.run
“`

Power off the Ubuntu-Desktop guest operating system using poweroff command
“`
poweroff
“`

Now Change the Network adapter 1 of VirtualBox VM from NAT to Bridged Adapter
This is to give your VM an IP from your network (this will help us to enable ssh)

Step 6 :
Install openssh server on Ubuntu Desktop VM
“`
sudo apt-get install openssh-server
“`

Step 7 :
Connecting via SSH from Windows 10 Bash Terminal

Install OpenSSH Client on any Linux Machine (if not already present)
“`
sudo apt install openssh-client
“`

SSH into the Ubuntu VM from Windows 10 Bash terminal or any other Linux Terminal with OpenSSH Client
“`
ssh [email protected]
“`

Step 8 :
SSH with Private key offer a secure manner of logging into a server without the need of a password.

Generate Key Pair using SSH
https://www.howtoforge.com/linux-basics-how-to-install-ssh-keys-on-the-shell
“`
ssh-keygen -o -b 4096 -t rsa
“`

Copy Public Key from Source Machine (your local machine) to the ubuntu desktop VM
“`
ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
“`
where ~/.ssh/id_rsa.pub is the path to your public key

Now try to SSH (this time you will use ssh key to login instead of password)
“`
ssh [email protected]
“`

One thought on “Linux Virtual Machine (Latest Ubuntu Desktop 20.04) on Windows 10 Home with Virtual Box | Year 2021

Leave a Reply

Your email address will not be published.