Read on:
Beginners’ Guide for Microsoft Hyper-V: Overview of Hyper-V – Part 1
Beginners’ Guide for Microsoft Hyper-V: How to Install Microsoft Hyper-V Using Server Manager – Part 2
Beginners’ Guide for Microsoft Hyper-V: How to Install Microsoft Hyper-V with PowerShell – Part 3
Read More
Windows Subsystem for Linux (WSL) is a great platform allowing users to access Linux without running full Linux virtual machines. As a result, it can be a great way to learn about virtualization, Linux, and other technologies that are key to DevOps in 2023 and beyond. Let’s look at WSL and how we can configure it in Windows for Linux and DevOps environments.
What is Windows Subsystem for Linux (WSL)?
Windows Subsystem for Linux (WSL) is a solution allowing developers, DevOps professionals, and lab enthusiasts to run GNU/Linux environments on a Windows host. It enables using native Linux utilities, tools, applications, and other technologies without spinning up a Linux virtual machine or even dual-booting a host operating system between Windows and Linux.
In effect, it allows you to have the best of both worlds, as you still have access to Windows for applications and solutions that are Windows-based. But then, you have access to native Linux tools when needed. In addition, you can run many great Linux solutions as part of Windows Subsystem for Linux, including:
- Bash Shell prompt
- Bash Shell scripting
- Run Linux graphical applications
- Run Docker and Kubernetes lab environments
- Use configuration management tools like Ansible that are better suited for Linux
These are just a few of the use cases that come up with WSL, and there are many others that one will be able to use with the native WSL environment.
WSL 1 vs. WSL 2
In case you are wondering, there are a couple of versions of WSL referenced in the documentation, and each one is compatible with Windows operating systems. WSL 1 is the older of the two versions and is compatible with older Windows client and Server operating systems. Windows Server 2019 is only compatible with WSL 1. However, Windows Server 2022 added support for WSL 2.
WSL 2 is the newest implementation of Windows Subsystem for Linux and provides the most features and capabilities between the two. Among the features, is increased performance and full system call compatibility compared to WSL 1. In addition, you can run the same Linux distros on either WSL 1 or WSL 2.
Now found in the Microsoft Store
One of the significant changes introduced at the end of 2022 with Windows Subsystem for Linux is it is now available on the Microsoft Store. You no longer need to download and integrate WSL 2 as an operating system feature. It can be installed using the Microsoft Store.
Also, there is no longer the need to install additional “kernel updates” as part of the WSL 2 installation. Instead, all of the required components are installed with the Microsoft Store installation.
Installing Windows Subsystem for Linux
As mentioned above, the Windows Subsystem for Linux is now available in the Microsoft Store. Therefore, installing WSL 2 is now a simple act of installing the store app.
You can verify you are running the Microsoft Store version of WSL by issuing the wsl –version command. If it is the in-operating system version installed from “optionalfeatures,” the version command will not return results. However, if you are running the Microsoft Store version of WSL, you should see something similar to the following:
The process of migrating to the new Microsoft Store version of WSL from the in-operating system version is easy. You simply install WSL from the Microsoft Store, and it will overwrite the existing in-operating system version of WSL. Once you migrate to the Store version, you assume all the benefits of the installation.
Installing a Linux distribution in WSL
After installing the Windows Subsystem for Linux app from the Microsoft Store, we need to install a Linux distribution for WSL. The process of installing a Linux distribution is easy. You use the following command:
Wsl –install
Once the distribution finishes downloading, you will see the message below as the distribution finalizes the installation of Linux in WSL.
WSL Initial Setup
The WSL Initial Setup comprises configuring your initial username for the Linux distribution:
Below, we have successfully configured Ubuntu 22.04.1 LTS from the Microsoft Store, configured the username, and it is ready to use.
Like any Linux distribution, we need to run updates and make sure we are fully patched. To check for updates and install updates:
sudo apt update && sudo apt upgrade
Windows Subsystem for Linux FAQs
Is Windows Subsystem for Linux free?
There is no license cost with Windows Subsystem for Linux. You can run the Windows Subsystem for Linux solution if you are licensed for Windows.
Can you run Windows Subsystem for Linux on Windows Server?
Yes, you can. You can run WSL 1 in Windows Server 2019 and WSL 2 in Windows Server 2022. However, Microsoft does not allow you to run a “non-interactive” version of WSL to host services. Instead, you will need to use virtual machines for that purpose. It is still described as a development and lab environment solution. Hopefully, this will change in the future.
Can you run multiple versions of Linux with WSL?
Yes, you can. With WSL, you can install many popular Linux distributions. These include Ubuntu, Redhat, Suse, Debian, Alpine etc. You can also run these simultaneously and in parallel with each other. They are completely isolated and segregated from one another.
Wrapping Up
Windows Subsystem for Linux is an excellent tool for beginners and experienced administrators alike. It provides quick and easy access to a Linux Bash shell and native Linux applications and tools from within Windows without needing a dedicated Linux virtual machine. Now that Microsoft has added Windows Subsystem for Linux to the Microsoft Store, installing WSL is now easier than ever and provides many benefits, including a more streamlined installation process and better lifecycle management.
Beginners Guide for Microsoft Hyper-V: How to Install Microsoft Hyper-V in Windows Server Core – Part 4
Beginners Guide for Microsoft Hyper-V: Remote Management of Hyper-V – Part 5
Beginners Guide for Microsoft Hyper-V: How to Install Hyper-V Server – Part 6
Beginner’s Guide for Microsoft Hyper-V: What is Azure Stack HCI – Part 7
Beginner’s Guide for Microsoft Hyper-V: Windows Admin Center Hyper-V Management – Part 8
Beginner’s Guide for Microsoft Hyper-V: Configuration of Hyper-V Networking Best Practices – Part 9
Beginner’s Guide for Microsoft Hyper-V: Hyper-V Storage Best Practices and Configuration – Part 10
Beginner’s Guide for Microsoft Hyper-V: How to build a Virtual Lab with Hyper-V – Part 11
Beginner’s Guide for Microsoft Hyper-V: Top 10 PowerShell Commands for Hyper-V – Part 12
Beginner’s Guide for Microsoft Hyper-V: How to Create a Hyper-V Virtual Machine – Part 13
Beginner’s Guide for Microsoft Hyper-V: Hyper-V Shared Storage for Beginners – Part 14
Beginner’s Guide for Microsoft Hyper-V: How to Create Hyper-V Cluster – Part 15
Beginner’s Guide for Microsoft Hyper-V: What is Non-Uniform Memory Access (NUMA) – Part 16
Beginner’s Guide for Microsoft Hyper-V: Hyper-V Dynamic Memory – Part 17
Beginner’s Guide for Microsoft Hyper-V: Cluster Aware Updating (CAU) – Part 18
Beginner’s Guide for Microsoft Hyper-V: Hyper-V Containers – Part 19
Beginner’s Guide for Microsoft Hyper-V: Managing Windows Server Containers with Windows Admin Center – Part 20
Beginner’s Guide for Microsoft Hyper-V: What are Hyper-V Checkpoints – Part 21
Beginners Guide for Microsoft Hyper-V: How to Create Cluster Shared Volumes (CSVs) – Part 22
Beginners’ Guide for Microsoft Hyper-V: VHD vs VHDX Vs AVHD/AVHDX: Overview of Virtual Disk Formats – Part 23
Beginners’ Guide for Microsoft Hyper-V: Hyper-V Live Migration – Part 24
Beginners’ Guide for Microsoft Hyper-V: Hyper-V High Availability – Part 25
Beginners’ Guide for Microsoft Hyper-V: How to Export and Import Hyper-V VM’s – Part 26
Beginners’ Guide for Microsoft Hyper-V: How To Install Docker Container on Windows Server – Part 27
Beginners’ Guide for Microsoft Hyper-V: How to Run Linux Containers on Hyper-V – Part 28
Beginners’ Guide for Microsoft Hyper-V: Containers vs Virtual Machines – Part 29
Beginners’ Guide for Microsoft Hyper-V: What is Azure Arc VM Management – Part 30
Beginners’ Guide for Microsoft Hyper-V: Azure Features in Windows Admin Center – Part 31
Beginners’ Guide for Microsoft Hyper-V: What is Microsoft Azure Arc – Part 32
Beginners Guide for Microsoft Hyper-V: How to Create a Virtual Switch in Hyper-V using Windows Admin Center – Part 33
Beginners Guide for Microsoft Hyper-V: Managing Hyper-V Server with Azure Arc – Part 34
Beginners Guide for Microsoft Hyper-V: Learn How to Install MicroK8s on Windows Kubernetes – Part 35
Beginners Guide for Microsoft Hyper-V: Top 8 Basic Docker Commands You Should Know – Part 36
Beginners’ Guide for Microsoft Hyper-V: Windows Docker Container Networking in Hyper-V – Part 37
Beginners’ Guide for Microsoft Hyper-V: How to run IIS in Docker Container – Part 38
Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.