The Windows Subsystem for Linux lets developers run a GNU/Linux environment including most command-line tools, etc. direct on Windows, unmodified, without the overhead of an ordinary virtual machine or dual-boot system.
Uses of WSL:
- Pick your preferred GNU/Linux distributions from the Microsoft Store.
- Run basic command-line tools, for example, grep, sed, awk, or other ELF-64 doubles.
- Run Bash shell and GNU/Linux command-line applications like tmux, emacs, SSHD, MySQL, and also could use the language compilers.
- Summon Windows applications utilizing a Unix-like command-line shell.
- Summon GNU/Linux applications on Windows.
WSL 2 is another form of the Windows Subsystem for Linux engineering that controls the Windows Subsystem for Linux to run ELF64 Linux binaries on Windows. Its essential objectives are to build file system execution, just as including full framework call compatibility. This new design changes how these Linux binaries associate with Windows and your PC’s equipment, yet at the same time gives a similar client experience as in WSL 1 (the current broadly accessible version).
Requirements For WSL 2:
- WSL 2 is only accessible in Windows 10, Version 1903, Build 18362, or higher.
- On the off chance that you are on Windows 10 form 1903 or 1909 ensure your minor build number is 1049 or higher.
- Running Windows 10, refreshed to version 2004 or higher, version 19041, for ARM64 systems.
- WSL 2 will work with VMWare 15.5.5+ and VirtualBox 6+.
Verifying the System Compatibility:
Step 1: Hold on the Windows logo key (on the keyboard) + R to open the run dialogue, and then type in the following command and select OK.
Step 2: If your OS builds version is not compatible, then we have to update the Windows.
Step 3: For updating, Click on the Windows logo in the bottom left corner of your screen and then type in the following command and press enter:
check for updates
Step 4: Now, select the “Check for updates” option from the menu listed, and then a dialog box will appear.
Step 5: Click on the “Check for Updates” button on the screen, and after successful completion of the update, “restart” your machine. But, if you don’t get any information regarding the update then, after doing a restart/s you will be prompted an update.
Setting up WSL:
Step 1: Click on the Windows logo in the bottom left corner of your screen and then type in the following command:
Now, when the list appears in the menu, Right-Click on the “Windows Power Shell” option and chooses “Run as administrator”.
Step 2: Now, once the Power Shell is opened and ready to use, type the following command and hit enter:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Step 3: Restart your machine.
Step 4: After the restart, again run the “Windows PowerShell” in the administrator mode, and then type in the following command:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Step 5: Now, type in the next command:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Step 6: Now, again restart your machine.
Step 7: In order to update the kernel packages visit https://aka.ms/wsl2kernel, download the kernel package and install the same.
Step 8: In order to activate WSL 2 execute the following command in Windows Powershell running the same in administrator mode.
wsl --set-default-version 2
Installing and Setting up Kali Linux CLI:
Step 1: Hit the Windows logo button on your keyboard, and then type in the following command and then, choose the “Microsoft Store” option from the menu.
Step 2: Once the Microsoft store opens, search for “Kali Linux” in the search bar.
Step 3: On the Kali Linux page, click on the “Get” option in order to download the Kali Linux app.
Step 4: Once the Kali Linux app is downloaded, close the Microsoft-Store.
Step 5: Click on the Windows logo in the bottom left corner of your screen and then type in the following command and press enter:
Step 6: After opening the Kali Linux app, the distribution will be installed in few seconds completely.
Step 7: Then, type in the credentials that you want to set in for the login purpose. Now, you will be able to use the Kali Linux easily in the command-line prompt and also execute the basic commands without an error.
Note: The base image does not contain any tool, or a graphical interface in order to keep the image small, however, it can be downloaded and installed via “apt” commands easily.
Setting Up Kali Linux(GUI):
Step 1: Open the Kali Linux app and login with your credentials.
Step 2: Type in the following command and hit enter:
sudo apt update && sudo apt upgrade -y
Step 3: After the successful completion of the above command, type the following command and hit Enter:
sudo apt upgrade && sudo apt install kali-win-kex -y
Step 4: Now, once the above command is completed installing, then type in the following:
This will initiate the process to open up the GUI environment of the Kali Linux distribution installed.
1. Now, whenever we have to close the GUI opened, then we will press the “fn” key with “f8” in order to select the “exit viewer” option.
2. Then, after exiting the viewer type in the following command in order to completely close the running services:
3. Thereafter, whenever we want to start the GUI Kali Linux environment then we will firstly open the Kali Linux app, and then type in the following commands by sequence: [or else you will get an error.]
kex stop [In any case you forgot to stop the kex services running before.] kex
Note: The above GUI setup will work on Kali Linux versions 2020.3 or later.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Dual Boot Kali Linux with Windows
- Difference Between Arch Linux and Kali Linux
- Kali Linux - Password Cracking Tool
- Difference Between Ubuntu and Kali Linux
- How to Install Lazy Script in Kali Linux?
- Difference between Kali Linux and Parrot OS
- Kali Linux Tools
- What is Vulnerability Scanning in Kali Linux?
- Introduction to Kali Linux
- How to Change the Mac Address in Kali Linux Using Macchanger?
- How to Hack WPA/WPA2 WiFi Using Kali Linux?
- Kali Linux - File Management
- Kali Linux - Default Passwords
- Kali Linux - Crunch Utility
- How to Create Reverse Shells with Netcat in Kali Linux?
- Kali Linux - Terminal and Shell
- Kali Linux - Command Line Essentials
- How to Change the username or userID in Kali Linux?
- Difference Between Fedora and Kali Linux
- Kali Linux - Exploitation Tools
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.