To enable Windows Subsystem for Linux (WSL) on Windows 10, follow these steps:
Enable WSL Feature
- Open PowerShell as Administrator:
- Press
Win + X
and select Windows PowerShell (Admin) or search for PowerShell, right-click, and choose Run as Administrator.
- Press
- Run the command to enable WSL: Type the following command in the PowerShell window and press Enter:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
This command enables the WSL feature on your Windows 10 system. - Enable Virtual Machine Platform (for WSL 2): If you want to use WSL 2 (the newer version with better performance), run this command in PowerShell as well:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
- Restart your PC: After running these commands, restart your computer to apply the changes.
Install a Linux Distribution
- Open Microsoft Store: After enabling WSL, open the Microsoft Store.
- Search for a Linux distribution: Search for distributions like Ubuntu, Debian, Kali Linux, etc.
- Install the distribution: Choose your preferred distribution and click Get or Install.
- Launch the distribution: Once installed, open the distribution from the Start menu. It will take a few minutes to set up the Linux environment on first launch.
Set Up and Use WSL
- Once the distribution is launched, you’ll be prompted to create a user account and password for your Linux system.
- After setup, you can start using Linux commands directly in the terminal.
Now you can switch between the Windows command line and the Linux environment seamlessly!
Additional optimizations (optional)
Disable the WSL subsystem beep prompt
bash
- Enter the file sudo vi /etc/inputrc
- Uncomment set bell-style none
- Exit and restart
zsh
- Enter the file sudo vi ~/.zshrc
- Add unsetopt beep at the end of the file
- Load the file source ~/.zshrc
vi
- Add a line in /.vimrc: set vb