A comprehensive, step-by-step guide to install and configure WSL2 on Windows 10/11, set up Ubuntu, and create user accounts with full administrative access.
- Prerequisites & System Requirements
- Quick Automatic Installation (Recommended)
- Manual Installation Method
- Installing Ubuntu Distribution
- Verify WSL Installation
- Creating a User Account in Ubuntu
- Setting Default User for WSL Distribution
- Post-Installation Setup
- Essential WSL Commands
- Troubleshooting
- Windows 11: Full native support for
wsl --install - Windows 10: Build 2004 or higher (Build 19041+)
Open PowerShell and run:
winverOpen PowerShell as Administrator and run:
systeminfoLook for the line:
Hyper-V Requirements: Virtualization Enabled In Firmware: Yes
If virtualization is disabled:
- Restart your computer
- Enter BIOS/UEFI settings (usually F2, F10, Del, or Esc during boot)
- Enable "Intel VT-x" or "AMD-V" (exact name varies by manufacturer)
- Save and exit
This is the easiest method for Windows 11 and recent Windows 10 builds.
- Press
Win + X - Select "Windows PowerShell (Admin)" or "Terminal (Admin)"
wsl --installThis single command will:
- Enable WSL feature
- Install WSL2 Linux kernel
- Set WSL2 as default
- Install Ubuntu (latest LTS version)
Restart-ComputerOr manually restart your computer when prompted.
To install a specific Ubuntu distribution:
wsl --install -d Ubuntu-22.04wsl --updateUse this method if wsl --install is not available on your system.
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestartdism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestartRestart-Computer- Download the WSL2 Linux kernel update package
- Run the installer (wsl_update_x64.msi)
Open PowerShell as Administrator:
wsl --set-default-version 2- Open Microsoft Store
- Search for "Ubuntu"
- Choose your preferred version:
- Ubuntu (latest LTS)
- Ubuntu 22.04 LTS
- Ubuntu 20.04 LTS
- Click "Install"
- Wait for installation to complete
- Click "Launch" or find it in Start Menu
wsl --install -d Ubuntu-22.04wsl --list --onlineOr shorthand:
wsl -l -owsl --list --verboseOr shorthand:
wsl -l -vExpected output:
NAME STATE VERSION
* Ubuntu-22.04 Running 2
The VERSION column should show 2. If it shows 1, convert it:
wsl --set-version Ubuntu-22.04 2wsl --set-default Ubuntu-22.04When you first launch Ubuntu from the Start Menu, it will automatically prompt you to:
- Create a username
- Set a password
- Confirm password
Important Notes:
- Username should be lowercase, no spaces
- Password won't show while typing (normal behavior)
- Remember this password - you'll need it for
sudocommands
If you need to create additional users or the automatic setup didn't occur:
From PowerShell:
wsl -d Ubuntu-22.04 -u rootadduser shreyasYou'll be prompted to enter:
- Password (twice)
- Full Name (optional, press Enter to skip)
- Room Number (optional, press Enter to skip)
- Work Phone (optional, press Enter to skip)
- Home Phone (optional, press Enter to skip)
- Other (optional, press Enter to skip)
The adduser command automatically:
- Creates home directory (
/home/shreyas) - Sets up default shell
- Copies skeleton files from
/etc/skel - Creates user group
usermod -aG sudo shreyasThis adds the user to the sudo group, allowing administrative commands.
Switch to the new user:
su - shreyasTest sudo privileges:
sudo -vEnter your password when prompted. If successful, you'll see no errors.
exitThe useradd command requires more manual configuration:
# Create user with home directory and bash shell
useradd -m -s /bin/bash shreyas
# Set password
passwd shreyas
# Add to sudo group
usermod -aG sudo shreyasNote: adduser is recommended for beginners as it's interactive and handles defaults automatically.
After creating a user, you'll want to set them as the default login user.
From PowerShell:
wsl -d Ubuntu-22.04 -u rootnano /etc/wsl.confAdd these lines:
[user]
default=shreyasReplace shreyas with your actual username.
- Press
Ctrl + Oto save - Press
Enterto confirm - Press
Ctrl + Xto exit
Exit the Ubuntu shell, then from PowerShell:
wsl --terminate Ubuntu-22.04Launch Ubuntu again from Start Menu or:
wsl -d Ubuntu-22.04You should now login as your specified user automatically.
From PowerShell (not inside WSL):
ubuntu2204 config --default-user shreyasNotes:
- Command name varies by distro:
ubuntu,ubuntu2204,ubuntu2004, etc. - Check exact command by looking at the app name in Start Menu
- This method may not work for all distributions
To verify which command to use:
wsl -lsudo apt update && sudo apt upgrade -ysudo apt install -y build-essential git curl wget ca-certificatessudo apt install -y python3 python3-pipcurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bashClose and reopen your terminal, then:
nvm install --ltsFollow official Docker documentation for WSL2-specific instructions.
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"- Install VS Code on Windows
- Install "Remote - WSL" extension in VS Code
- From WSL terminal, navigate to your project:
cd ~/projects code .
- Install from Microsoft Store: "Windows Terminal"
- Ubuntu will automatically appear as a profile
- Set Ubuntu as default (optional):
- Open Settings (Ctrl + ,)
- Set "Default profile" to Ubuntu
wsl --list --verboseOr: wsl -l -v
wsl -d Ubuntu-22.04wsl -d Ubuntu-22.04 -u shreyaswsl -d Ubuntu-22.04 -u rootwsl -d Ubuntu-22.04 -- ls -la /homewsl --set-default Ubuntu-22.04wsl --terminate Ubuntu-22.04wsl --shutdownwsl --updatewsl --versionwsl --export Ubuntu-22.04 C:\backup\ubuntu-backup.tarwsl --import Ubuntu-Restored C:\WSL\Ubuntu-Restored C:\backup\ubuntu-backup.tar --version 2wsl --unregister Ubuntu-22.04Solution:
- Download the kernel update: https://aka.ms/wsl2kernel
- Install the MSI package
- Run:
wsl --update
Solution:
- Restart computer and enter BIOS/UEFI
- Find "Virtualization Technology", "Intel VT-x", or "AMD-V"
- Enable it
- Save and exit BIOS
Solution: You're on an older Windows build. Use the Manual Installation Method.
Solution:
wsl --shutdown
wsl --unregister Ubuntu-22.04
wsl --install -d Ubuntu-22.04Solution:
Windows drives are mounted under /mnt/:
cd /mnt/c/Users/YourUsername/DocumentsSolution: Ubuntu filesystem is accessible from Windows at:
\\wsl$\Ubuntu-22.04\home\shreyas
Or type \\wsl$ in File Explorer address bar.
Solution:
Create /etc/wsl.conf as described in Setting Default User.
Solution: Reset password as root:
wsl -d Ubuntu-22.04 -u rootThen inside Ubuntu:
passwd shreyasSolution:
wsl --shutdownThen restart your distribution. If problem persists:
netsh winsock reset
netsh int ip reset allRestart Windows.
Found an error or have suggestions? Please open an issue or submit a pull request!
This guide is provided as-is for educational purposes.
Last Updated: December 2025