How to Install a Linux Distro Using WSL on Windows
If you use Windows but want a Linux development environment, you don't necessarily need dual boot, a virtual machine, or a second computer. Windows Subsystem for Linux (WSL) lets you run a Linux distribution directly inside Windows. In this guide, we'll install WSL, choose a Linux distribution, create a Linux user, and verify that everything is working. What Is WSL? WSL (Windows Subsystem for Linux) is a Windows feature that allows you to run Linux distributions alongside Windows. You can use a Linux terminal and tools such as: - Bash - Git - GCC - Python - Rust - Node.js - Vim - SSH - Linux package managers without installing Linux as a separate operating system. For developers, WSL is especially useful because you can keep Windows for your normal desktop applications while using Linux tools for development. Requirements Before starting, make sure you're running a supported version of Windows. Open PowerShell and run: winver You can also check your Windows version with: systeminfo For the easiest installation method, use a modern Windows 10 or Windows 11 system with WSL support. 1. Open PowerShell as Administrator Press: Windows + X Then select: Windows PowerShell (Admin) or: Terminal (Admin) You should see a terminal window with administrator privileges. 2. Install WSL The easiest method is: wsl --install This command enables the required Windows components, installs the WSL components, and normally installs Ubuntu as the default Linux distribution. After installation, Windows may ask you to restart your computer. Restart: shutdown /r /t 0 After Windows starts again, the Linux distribution setup should continue. 3. Check Available Linux Distributions You don't have to use Ubuntu. To see the distributions available through WSL, run: wsl --list --online You may see distributions such as: NAME Ubuntu Debian kali-linux openSUSE-Tumbleweed Ubuntu-24.04 The exact list can change over time. 4. Install a Specific Linux Distribution For example, to install Ubuntu: wsl --install -d Ubuntu Or, if you want Debian: wsl --install -d Debian You can replace the distribution name with one from: wsl --list --online For example: wsl --install -d Ubuntu-24.04 5. Create Your Linux User After the distribution starts for the first time, Linux will ask you to create a username. For example: Enter new UNIX username: You might enter: farhad Then create a password. When typing the password, nothing will appear on the screen. That's normal behavior in Linux terminals. Type the password and press Enter. 6. Verify the Installation Inside your Linux terminal, run: uname -a Then: cat /etc/os-release You should see information about your Linux distribution. You can also check the current user: whoami And check your home directory: pwd You should get something similar to: /home/farhad Your Linux environment is now running. 7. Check WSL From Windows Close the Linux terminal and open PowerShell. Run: wsl --list --verbose You should see something similar to: NAME STATE VERSION * Ubuntu Running 2 The important part is: VERSION 2 That means you're using WSL 2. WSL 2 uses a lightweight virtualized Linux environment and provides much better Linux compatibility than the original WSL 1 architecture. 8. Start Your Linux Distribution You can start your default distribution by simply running: wsl Or you can specify a distribution: wsl -d Ubuntu For Debian: wsl -d Debian You can also see installed distributions with: wsl -l 9. Update Linux After installing Linux, update its package information. For Ubuntu or Debian: sudo apt update Then upgrade installed packages: sudo apt upgrade You can combine them: sudo apt update && sudo apt upgrade It's a good idea to do this before installing development tools. 10. Access Windows Files From Linux One of the useful features of WSL is that you can access your Windows drives. Your Windows C: drive is normally available at: /mnt/c For example: cd /mnt/c You can see your Windows files: ls Your Windows user directory might be accessible through: cd /mnt/c/Users This makes it possible to work between Windows and Linux. 11. Access Linux Files From Windows WSL also provides a way to access your Linux filesystem from Windows. From Windows File Explorer, you can enter: \wsl$ in the address bar. You should see your installed WSL distributions. For example: \wsl$\Ubuntu This allows Windows applications to interact with files inside your Linux environment. For development projects, however, it's generally best to keep Linux-oriented projects inside the Linux filesystem rather than constantly working across /mnt/c . 12. Install Development Tools Now you can use Linux normally. For example, install Git: sudo apt install git Install GCC: sudo apt install build-essential Check GCC: gcc --version Install Vim: sudo apt install vim Now you have a basic Linux development environment running inside Windows. Installing Another Distribution Later You can install multiple Linux distributions on the same Windows installation. For example: wsl --install -d Debian Then check them: wsl --list --verbose You might have: NAME STATE VERSION * Ubuntu Stopped 2 Debian Stopped 2 You can start Debian with: wsl -d Debian Making a Distribution Your Default If you have multiple distributions installed, you can choose which one starts when you run: wsl For example: wsl --set-default Debian Now: wsl will start Debian by default. Useful WSL Commands Here are some commands you'll use frequently. List installed distributions wsl --list --verbose List available distributions wsl --list --online Start WSL wsl Start a specific distribution wsl -d Ubuntu Shut down WSL wsl --shutdown Stop a specific distribution wsl --terminate Ubuntu Check WSL version wsl --version Update WSL wsl --update Set the default distribution wsl --set-default Ubuntu Common Problems wsl --install Doesn't Work First check whether WSL is available: wsl --status Then try: wsl --update You may also need to enable Windows virtualization features or restart Windows after enabling WSL. The Distribution Download Fails If you receive a network-related error while installing a distribution, check your internet connection first. You can also check the available distributions: wsl --list --online Then retry the installation: wsl --install -d Debian Check Whether Virtualization Is Enabled Open Task Manager: Ctrl + Shift + Esc Go to: Performance โ CPU Look for: Virtualization: Enabled If virtualization is disabled, you may need to enable the appropriate virtualization setting in your computer's UEFI/BIOS. WSL vs Dual Boot WSL and dual boot solve different problems. With dual boot, you install Windows and Linux as separate operating systems and choose one when the computer starts. With WSL, Linux runs alongside Windows. For development, WSL can be much more convenient because you don't need to reboot your computer every time you want to use Linux. A simple setup might look like: Windows โ โโโ WSL 2 โ โโโ Ubuntu โโโ Debian โโโ Other Linux distributions Conclusion Installing Linux with WSL is one of the easiest ways to get a Linux development environment on Windows. The basic workflow is: wsl --install Then: wsl --list --online Choose a distribution: wsl --install -d Ubuntu Start it: wsl And verify it: uname -a Once it's installed, you can use Linux tools, package managers, compilers, Git, editors, programming languages, and other development tools directly from Windows. Windows doesn't have to mean giving up the Linux development environment. With WSL, you can have both. Top comments (0)
Comments
No comments yet. Start the discussion.