Table of Contents
You can now install everything you need to run WSL on Windows Server 2022 by entering this command in an administrator PowerShell or Windows Command Prompt and then restarting your machine.
Enable the Windows Subsystem for Linux
This command will enable the required optional components, download the latest Linux kernel, set WSL 2 as your default, and install a Linux distribution for you (Ubuntu by default).
wsl --install
PS C:\Users\Administrator> wsl --install
Installing: Virtual Machine Platform
Virtual Machine Platform has been installed.
Installing: Windows Subsystem for Linux
Windows Subsystem for Linux has been installed.
Downloading: Ubuntu
Requested operation is successful. Changes will not be effective until the system is rebooted.
In the first run, you need configure username and password for the Linux distribution.
Installing, this may take a few minutes...
Please create a default UNIX user account. Username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: bon
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
Welcome to Ubuntu 20.04 LTS (GNU/Linux 4.4.0-20348-Microsoft x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Mon Oct 3 06:16:17 PDT 2022
System load: 0.52 Processes: 7
Usage of /home: unknown Users logged in: 0
Memory usage: 20% IPv4 address for eth0: 10.10.230.7
Swap usage: 0%
0 updates can be installed immediately.
0 of these updates are security updates.
The list of available updates is more than a week old.
To check for new updates run: sudo apt update
This message is shown once once a day. To disable it please create the
/home/bon/.hushlogin file.
bon@WIN-T0IDO6F6BCA:~$
Get the list of installed distributions in this server using this command:
PS C:\> wsl -l -v
NAME STATE VERSION
* Ubuntu Running 1
Get the list of valid distributions then install another one using wsl -l -o command.
wsl -l -o
The following is a list of valid distributions that can be installed.
Install using 'wsl --install -d <Distro>'.
NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
openSUSE-42 openSUSE Leap 42
SLES-12 SUSE Linux Enterprise Server v12
Ubuntu-16.04 Ubuntu 16.04 LTS
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
Install another Linux distribution:
wsl --install -d debian
Downloading: Debian GNU/Linux
[==========================48.6%
Installing: Debian GNU/Linux
Debian GNU/Linux has been installed.
Launching Debian GNU/Linux...
PS C:\> wsl -l -v
NAME STATE VERSION
* Ubuntu Stopped 1
Debian Running 1
ADVERTISEMENT
Not a reader? Watch this related video tutorial:
5/5 - (1 vote)