Working in Linux environment on windows using Windows Subsystem for Linux (WSL)

# Installing WSL for Windows

If you are a Windows user who wants to run Linux applications on your machine, you have two main options: using a virtual machine (VM) or using Windows Subsystem for Linux (WSL).

Windows Subsystem for Linux (WSL) is a feature that allows developers to run Linux applications and tools on Windows without the overhead of a virtual machine or dual-boot setup. It does not require a full Linux kernel or a separate operating system, but rather uses a compatibility layer that translates Linux system calls to Windows ones. This means that you can run Linux commands and programs without any noticeable performance overhead or disk space consumption. WSL supports a variety of Linux distributions, such as Ubuntu, Debian, Kali, and more. In this blog post, I will show you how to install WSL on Windows 10 or Windows 11 using the wsl –install command.

## Prerequisites

To install WSL, you need to have Windows 10 version 2004 or higher (Build 19041 or higher) or Windows 11. You also need to have administrator privileges on your machine. To check your Windows version and build number, open the Settings app and go to System > About.

** You might want to use ‘Windows Terminal App’, it can be installed from Microsoft store. This app embedded interface that can give you the terminal interface for any linux distro you install. Windows 11 has it installed already

Ubuntu in Terminal App

## Install WSL command

The easiest way to install WSL is to use the wsl –install command in PowerShell or Command Prompt. This command will enable the required features, download and install the Ubuntu distribution (by default), and set up your Linux user account. To run this command, follow these steps:

1. Open PowerShell or Command Prompt or The Terminal App as an administrator by right-clicking on the Start menu and selecting “Run as administrator”.

2. Enter the following command and press Enter: `wsl –install`

wsl install

3. Wait for the installation process to complete. You may be prompted to restart your machine.

4. After restarting, open a new PowerShell or Command Prompt window and enter `wsl` to launch Ubuntu.

## Change the default Linux distribution

If you want to install a different Linux distribution than Ubuntu, you can use the -d flag with the wsl –install command. For example, to install Debian, you can enter: `wsl –install -d Debian`. To see a list of available Linux distributions, you can enter: `wsl –list –online` or `wsl -l -o`.

You can also find different distributions from the Microsoft store app

You can also install additional Linux distributions after the initial install using the same command. To switch between different distributions, you can use the `wsl -d <Distribution Name>` command.

Installing Nasm on WSL

After having your Windows Subsystem for linux installed on your windows, and has restarted, you can find ubuntu in your apps, on the start menu.

You can also launch the Terminal App and click on the arrow down on the title bar, you find Ubuntu in the list of options, you  can click on it to open the ubuntu terminal.

you can also find Linux and ubuntu right in your file explorer on windows

linux ubuntu

After opening the ubuntu on the terminal app, you can run sudo apt install nasm to install the nasm assembler on your wsl

Before running the command to install the nasm, we’ll have to first upgrade and update our ubuntu. Run

sudo apt-get update && apt-get upgrade

to get the latest links. Then run the sudo apt install nasm

installing nasm

That is it, you now have a lightweight virtual machine on your windows that can enable you work in linux environment on desktop without the need for a virtual box software.

You can literally install any app you want on linux using this wsl and use it right in your windows.

You can use your Windows Subsystem for Linux while working in VS code on windows.

Leave a Reply

Your email address will not be published. Required fields are marked *