How to Install Ubuntu with WSL on Windows 10

|

,

|

The tutorial guides students and new users on installing Windows Subsystem for Linux (WSL) 2 and Ubuntu on Windows 10. Requirements include Windows 10 May 2019 or later and a Hyper-V Virtualization supported computer. The guide outlines steps to enable WSL in Windows, enable Virtual Machine Platform, and configure WSL 2 as the default. Then,…

This brief tutorial shows students and new users how to install Windows Subsystem for Linux (Windows Subsystem for Linux) 2 on Windows 10 and install Ubuntu.

Installing Ubuntu on Windows 10 using the Windows Subsystem for Linux (WSL) allows you to use Ubuntu Terminal and run Ubuntu command line utilities, including bash, ssh, git, apt, and many more.

It provides a way to run a Linux environment on Windows, which can be helpful for developers who need to use Linux tools but prefer the Windows operating system. WSL 2 offers significant performance improvements over its predecessor, making it a great option for those who need to run Linux environments on their Windows 10 machines.

Back in 2017, Windows released the original WSL version. WSL 2 is an improvement over version 1 and comes with a performance boost and complete system call compatibility. It is built with a new architecture that delivers features that make WSL a fantastic way to run a Linux environment in Windows.

To install WSL 2 on Windows 10, these two requirements must be met:

  • Windows 10 May 2020 (2004), Windows 10 May 2019 (1903), or Windows 10 November 2019 (1909) or later
  • A computer with Hyper-V Virtualization support

When you’re ready to enable WSL 2 on Windows 10, follow the steps below:

Enable WSL in Windows

To enable WSL in Windows, you will want to open the PowerShell terminal as administrator. Click on Start, then begin typing PowerShell.

Next, right-click the Windows PowerShell app and choose to run as administrator.

When the console opens, run the commands below:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

After installing, you should get a success message similar to the lines below:

Deployment Image Servicing and Management tool
Version: 10.0.19041.844

Image Version: 10.0.19042.844

Enabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.

Enable Virtual Machine Platform

WSL 2 requires Windows 10 Virtual Machine Platform to be enabled. This is not Hyper-V. To enable the VM platform feature in Windows, run the commands below from the same PowerShell administrator’s console.

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

If you’re using Windows 10 version lower than 2004, then use the commands below:

Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -NoRestart

When you’re done running the commands above, restart your computer for all the configuration changes to apply. If you don’t restart, the below command might not be recognized.

After restarting your computer, log back in and launch PowerShell as administrator. Then, run the commands below to configure WSL 2 as the default version of WSL.

wsl --set-default-version 2

Install Ubuntu on Windows 10

Now that WSL 2 is installed and ready to be used, open the link below to download and install a copy of Ubuntu 20.04 from the Windows store.

Get Ubuntu 20.04 LTS – Microsoft Store

Ubuntu 20.04 LTS on Windows allows you to use Ubuntu Terminal and run Ubuntu command line utilities, including bash, ssh, git, apt, and many more.

Click the Get button and install. After installing Ubuntu, you’ll want the option to launch Ubuntu from the Windows WSL environment.

After launching, Ubuntu should install and prompt you to create your account.

Installing, this may take a few minutes.
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: richard
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 4.4.0-19041-Microsoft x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Mon Apr 12 17:57:37 CDT 2021

  System load:    0.52      Processes:             7
  Usage of /home: unknown   Users logged in:       0
  Memory usage:   26%       IPv4 address for eth0: 10.0.2.15
  Swap usage:     0%

1 update can be installed immediately.
0 of these updates are security updates.
To see these additional updates run: apt list --upgradable

That should do it!

Some troubleshooting commands to run when you run into issues.

wsl --set-default-version 1
bcdedit /set hypervisorlaunchtype auto start

Conclusion:

This post showed you how to install WSL 2 on Windows 10 and Ubuntu 20.04. If you find any error, please report it in the comment form below.


Discover more from Geek Rewind

Subscribe to get the latest posts to your email.

Like this:



One response to “How to Install Ubuntu with WSL on Windows 10”

  1. Anant Saini Avatar
    Anant Saini

    Hey, I have installed the ubuntu by following all the steps as you mentioned. Thanks for it, but there is a little problem. I am learning linux commands and other functionality so I didn’t know that linux passwords are not shown on screen while you are actually typing them. This lack of information lead to me typing some random password and I pressed enter thinking that my password is nothing.
    Now, as I learned more linux commands and features, many commands require me to enter that password which I randomly typed while installing ubuntu on windows. I want to reset my password but passwd command requires current password which I don’t know. How to reset my password?
    Kindly Help.
    Thank You

Leave a Reply

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

Blog at WordPress.com.

Discover more from Geek Rewind

Subscribe now to keep reading and get access to the full archive.

Continue reading