WSL2: Difference between revisions

From Wiki
Line 10: Line 10:
</pre>
</pre>
</blockquote>
</blockquote>
# Update WSL Kernel
# Restart
# Restart
# Install Ubuntu from Microsoft Store
# Install Ubuntu from Microsoft Store

Revision as of 20:21, 4 March 2021

Windows Subsystem for Linux

Installation

  1. Run from Admin-PowerShell
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2
  1. Update WSL Kernel
  2. Restart
  3. Install Ubuntu from Microsoft Store

Using New Windows Terminal

  • profiles.json
    • set defaultProfile to Ubuntu
    • for linux home dir:
"commandline" : "wsl.exe ~ -d Ubuntu-18.04",


 "profiles":
    [
        {
            "guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
            "source": "Windows.Terminal.Wsl",
            "name": "Ubuntu-18.04",
            "commandline": "wsl.exe ~ -d Ubuntu-18.04",
            "fontSize": 10
        },
        {
            "name": "server1",
            "commandline": "wsl.exe ~ -d Ubuntu-18.04 ssh server1",
            "fontSize": 10
        }
    ]

Running Linux Commands

  • using bash.exe
bash.exe -c "jupyter-notebook ; /bin/bash"


  • using wsl
wsl jupyter-notebook &

fstab

z: /mnt/z drvfs rw,relatime 0 0

mount network share

mount -t drvfs '\\server\share' /mnt/share


Nmap

  • Install Nmap for Windows
  • .bashrc:
alias nmap='"/mnt/c/Program Files (x86)/Nmap/nmap.exe"'

Linux GUI Apps on Windows