Running Linux in Windows Using WSL (Windows Subsystem for Linux)

WSL (Windows Subsystem for Linux) provides access to a Linux environment without the need for a separate virtual machine or dual booting.

Instructions for Installing a Distro

  1. In Windows, open a Terminal (Admin).
  2. Run wsl --list --online to see a list of Linux distros.
  3. Run wsl --install -d "DistroName" to install a distro (where DistroName is replaced with a particular distro). In this example, we are installing wsl --install -d "Ubuntu-22.04".
  4. Restart your computer.
  5. You will be asked to create a Unix user account (just provide a username after "Enter new UNIX username:")
  6. Provide a password.
  7. If you exit, you can get back to the usual Linux shell prompt by opening a Windows terminal and typing the command
    wsl -d "Ubuntu-22.04".
  8. Remember to change to your home directory.
  9. To install software (e.g., gcc) try to run a command and if not present the shell will display a message to install it.
  10. Before installing packages execute
    
                    sudo apt-get update
                    sudo apt-get upgrade -y
                
  11. To install gcc execute
    
                    sudo apt install gcc
                    sudo apt-get install libc6-dev
                
  12. At this point try to compile a file. vim and nano are installed by default so already have an editor.
  13. To install gdb and valgrind
                    sudo apt install gdb
                    sudo apt install valgrind
                
  14. You can see the directory structure associated with the Linux installation by selecting File Explorer and under "This PC" and "Network" you will see "Linux". Under "Linux" a folder will appear for each distro you may have installed. If you expand one of the folders you will see the "Home."
  15. You can access your distro via VS Code by installing the "Visual Studio Code WSL" extension. After installing it, in VS Code, select F1, and typo: WSL and select entry "Connect to WSL using Distro..", select the distro and, and open a folder. Note: You can also start VS Code by executing code .
  16. If you use MobaXTerm, you can open a terminal by right-clicking on the icon associated with the distro you installed.

Web Accessibility