HostingB2B » How to » Dedicated Servers » How to Set Up Linux Bash on Windows with WSL 2

How to Set Up Linux Bash on Windows with WSL 2

Summarize with:
Share:

Running a native VPS Linux environment on Windows Server is no longer a workaround — it’s a streamlined, high-performance solution powered by Windows Subsystem for Linux (WSL 2). With near-native performance and full system call compatibility, WSL 2 allows developers and system engineers to run Linux workloads directly on Windows with minimal overhead. This evolution has simplified the development workflow, making it essential to know how to set up Linux Bash on Windows with WSL 2 for a seamless experience. By following a few straightforward steps, you can transform your Windows machine into a robust workstation capable of running complex Linux scripts and utilities alongside your favorite desktop apps. This guide outlines the fastest and most efficient way to deploy a fully functional Bash environment using modern tooling.

1. Prerequisites: System Requirements

Before installation, ensure your system meets the following requirements:

Related ReadHow to Install a GUI on Ubuntu Server for Remote Access
  • Operating System: Windows 10 (version 2004, build 19041+) or Windows 11
  • Virtualization: Enabled in BIOS/UEFI
    • Intel: VT-x
    • AMD: SVM
  • Architecture: x64 or ARM64

WSL 2 relies on a lightweight virtual machine, so hardware-assisted virtualization must be active.

Modern Windows versions provide a simplified one-command installation.

Open PowerShell as Administrator and run:

wsl --install

This command will automatically:

  • Enable required Windows features
  • Install WSL 2 as the default version
  • Download and install Ubuntu
  • Set up the Linux kernel

💡 Note: A system restart is required after this command completes before you can launch your Linux environment.

This is the fastest and most reliable method in 2026.

3. Optional: Install a Specific Linux Distribution

To install a specific version (for example, Ubuntu 22.04), run:

wsl --install -d Ubuntu-22.04

To view available distributions:

wsl --list --online

⚠️ This command requires an active internet connection and may be slow or fail in restricted network environments.

4. First Launch & Initial Setup

After restarting, launch your Linux distribution from the Start menu.

During the first run:

  • Create a UNIX username and password (independent from your Windows credentials)
  • Update system packages:
sudo apt update && sudo apt upgrade -y

This ensures your environment is secure and up to date.

5. Verify and Configure WSL Version

Confirm that your system is running WSL 2:

wsl -l -v

If needed, set WSL 2 as default:

wsl --set-default-version 2

To restart the WSL environment:

wsl --shutdown

6. File System Interoperability

WSL provides seamless access between Windows and Linux file systems.

Access Windows files from Linux:

cd /mnt/c/Users/YourName/Documents

Open a Linux directory in Windows Explorer:

explorer.exe .

Access Linux files from Windows — navigate to the following path in Windows Explorer:

\\wsl$\Ubuntu\

This enables smooth cross-platform workflows in both directions.

7. Optimization: Professional Toolkit

To fully leverage your Linux environment, integrate the following tools:

Terminal Experience

Install Windows Terminal for:

  • Multi-tab sessions
  • GPU-accelerated rendering
  • Custom profiles and shells

Development Environment

Use Visual Studio Code with the Remote – WSL extension:

  • Run code directly inside Linux
  • Use Windows UI with Linux runtime
  • Seamless debugging and Git integration

Containers (Docker Support)

WSL 2 supports containers via Docker Desktop integration.

⚠️ Note: Docker Desktop requires a separate installation. It is free for personal use but requires a paid license for enterprise use. Review Docker’s licensing terms before deploying in a commercial environment.

This enables:

  • Running Docker containers inside WSL
  • Native-like performance
  • Simplified DevOps workflows

8. Manual Installation (Advanced / Legacy Method)

For advanced users who require granular control, you can still enable WSL manually:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Restart your system, then proceed with manual configuration.

Summary

By following this guide, you have deployed a modern Linux environment on Windows 10 or 11 using WSL 2. Key takeaways:

  • Restart is required after wsl --install before launching Linux
  • Both Windows directions work — Linux can access Windows files via /mnt/c/, and Windows can access Linux files via \\wsl$\
  • Docker Desktop requires a separate install and license review for enterprise use
  • WSL 2 delivers near-native performance for compilers, automation scripts, and containerized workloads — all without leaving your Windows ecosystem

© 2026 All Rights Reserved. HostingB2B

Hosting B2B LTD is a Company registered in Cyprus with Company number HE410139 and VAT CY10410139C

Contact Info

© 2026 All Rights Reserved. HostingB2B