First, you must be running a recent build of Windows (Build 20262+). To check your version and build number, select Windows logo key + R, type winver, select OK.
Open PowerShell (or Windows Command Prompt) and enter: wsl --install
The command will install WSL and Ubuntu as the default Linux distribution. To install a different Linux distribution, use command like "wsl --install -d Debian" for Debian.
After the installation, open the installed distribution such as Ubuntu, and create your first account with a username and a password. This account will be a Linux administrator, with the ability to run sudo administrative commands.
To change your password, run "passwd" command in Ubuntu. If you forget your password, open PowerShell in Windows, and type:
wsl -u root
Once your WSL distribution has been opened at the root level inside PowerShell, you can use this command to update your password: passwd where is the username of the account in the distribution whose password you've forgotten.
To update and upgrade your packages using the preferred package manager for the distribution. For Ubuntu or Debian, use the command:
sudo apt update && sudo apt upgrade
Make sure to store your WSL files in Linux system, not in Windows, for faster access. To see your files in your Linux home, type
explorer.exe .
Be sure to add the period at the end of the command to open the current directory. You may also use command Linux command to change director and list files. The home directory is
cd /home
To list the content in the current directory,
ls -l
To view a text file, use nano, vi, and pico
To install new apps in WSL, use either snap or apt commands. For example, to install Visual Studio Code in WSL, type
sudo snap install --classic code
or
sudo apt install code
To install python with pip, type
sudo apt install python3-pip
This will install missing components for installing Python packages.
|