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
-
In Windows, open a Terminal (Admin).
-
Run wsl --list --online to see a list of Linux distros.
-
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".
- Restart your computer.
- You will be asked to create a Unix user account (just provide a username after "Enter new UNIX username:")
- Provide a password.
- 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".
- Remember to change to your home directory.
- To install software (e.g., gcc) try to run a command and if not present
the shell will display a message to install it.
- Before installing packages execute
sudo apt-get update
sudo apt-get upgrade -y
- To install gcc execute
sudo apt install gcc
sudo apt-get install libc6-dev
- At this point try to compile a file. vim
and nano are installed by default so
already have an editor.
- To install gdb and valgrind
sudo apt install gdb
sudo apt install valgrind
- 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."
-
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 .
-
If you use MobaXTerm, you can open a terminal by
right-clicking on the icon associated with the distro
you installed.
Web Accessibility