Skip to main content

WSL

· loading · loading · · ·
HDL Verilog HDL
Axolot Logic
Author
Axolot Logic
Digital Design Engineer
Table of Contents

Windows Subsystem for Linux (WSL) Setup Guide
#

This guide explains step-by-step how to install and configure WSL on a Windows machine. WSL allows you to run Linux commands and tools in a Windows environment — especially useful for development and testing.


1. What is WSL?
#

WSL is a feature that lets you run a full Linux distribution on Windows. There are two versions:

  • WSL 1: Offers better compatibility between Windows and Linux.
  • WSL 2: Includes a full Linux kernel and is faster and more efficient.

2. Installing WSL
#

Step 1: Enable the WSL Feature
#

  1. Open PowerShell as Administrator

    • Search for “PowerShell” in the Start menu, right-click, and select “Run as Administrator”.
  2. Enable WSL and Install Default Distro (Ubuntu):

    wsl --install
    

    This command installs all required components and sets up Ubuntu as the default distro.

Step 2: Restart Your System
#

  • If prompted during the setup, restart your computer to complete the installation.

3. Setting WSL Version
#

  1. Set WSL 2 as the Default:

    wsl --set-default-version 2
    
  2. Check Installed WSL Versions:

    wsl -l -v
    

💡 Required Windows Features: Only Windows Subsystem for Linux and Virtual Machine Platform are necessary. These can be enabled via Start > “Turn Windows features on or off”.


4. Installing Your Preferred Linux Distribution
#

  1. List Available Distributions:

    wsl --list --online
    
  2. Install a Specific Distro (e.g., Debian):

    wsl --install -d Debian
    
  3. Set Default Distro:

    wsl --set-default <DistributionName>
    

5. Configuring the Linux Environment
#

  1. Launch the Linux Terminal:

    • Open the terminal from Start Menu (e.g., type “Ubuntu” and hit Enter).
    • On first launch, you’ll be asked to create a username and password.
  2. Update the System:

    sudo apt update && sudo apt upgrade -y
    

6. WSL Settings & Advanced Configuration
#

Add Default Windows Path to Linux PATH
#

To access Windows tools from your Linux terminal:

echo 'export PATH=$PATH:/mnt/c/Windows/System32' >> ~/.bashrc
source ~/.bashrc

Improve WSL 2 Disk Performance
#

Create a ~/.wslconfig file with custom settings:

[wsl2]
memory=4GB
processors=2

7. Useful WSL Commands
#

Command Description
wsl --list --online Lists available distributions.
wsl --install -d <distro> Installs the specified Linux distribution.
wsl --set-default-version 2 Sets WSL 2 as the default version.
wsl --list --verbose Lists installed distros with version info.
wsl --terminate <distro> Shuts down the specified distro.
wsl --shutdown Shuts down all WSL instances and frees resources.

8. Troubleshooting
#

  1. WSL 2 Error: “WSL 2 kernel component is missing” → Download and install the WSL 2 kernel update.

  2. Performance Issues → Edit the ~/.wslconfig file to allocate more CPU/RAM.


9. Sample Usage
#

  1. Launch WSL (e.g., Ubuntu):

    • From the Start Menu, search for “Ubuntu” and open the terminal.
  2. Create and Run a Simple Script:

    echo 'echo "Hello, WSL!"' > hello.sh
    chmod +x hello.sh
    ./hello.sh
    

This guide covers WSL setup and basic configuration. Let me know if you need help customizing or extending your WSL environment! 😊

Related

Blocking vs Non-Blocking Assignments
· loading · loading
HDL Verilog HDL
Command-Line Input
· loading · loading
HDL Verilog HDL
Compiler Directives & Macros
· loading · loading
HDL Verilog HDL
Control Flow
· loading · loading
HDL Verilog HDL
Delay Controls
· loading · loading
HDL Verilog HDL
Git Installition for Windows
· loading · loading
HDL Verilog HDL

comments powered by Disqus