Arlen Holder
2020-05-16 08:19:23 UTC
Tutorial for setting up Ubuntu as a Windows Subsystem for Linux WSL in Windows 10
As always, this general-purpose tutorial is posted for two key reasons:
a. So that others benefit from all efforts, and,
b. So that others can _improve_ upon what is currently documented;
c. That way, even more people benefit from the end result.
Advantage of this 3-step command-line method:
a. It's essentially three cut-and-paste commands, click, click, & click.
b. No privacy leaks (i.e., no login, no Microsoft Store!)
c. You should be up and running in a few minutes.
Disadvantages of this method:
A. This tutorial doesn't cover adding Ubuntu 20.04 yet (I don't know how).
B. This tutorial doesn't cover enabling graphical applications yet.
C. This tutorial doesn't cover enabling sound (pulse audio) yet.
Thanks to Mike Easter for pointing to the fundamental documentation.
<https://wiki.ubuntu.com/WSL>
Given that documentation, here are the 3 cut-and-paste command-line steps:
1. Download the Ubuntu APPX
2. Add the Ubuntu APPX
3. Run the Ubuntu EXE
1. *Download the Ubuntu APPX*
<https://wsldownload.azureedge.net/CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2018.817.0_x64__79rhkp1fndgsc.Appx>
Name: CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2018.817.0_x64__79rhkp1fndgsc.Appx
Size: 224629284 bytes (214 MiB)
SHA256: 96E4E3E336F08DDE1DF81FA9C266C5C7750BA92729857E92BDE36BF84A1DB002
Note: If you can find the Ubuntu 20.04 appx, please advise of the URL.
2. *Add the Ubuntu APPX*
Win+R > powershell
PS> Start-Process powershell -verb runAs
PS> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
PS> Add-AppxPackage -Path "C:\software\iso\ubuntu\CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2018.817.0_x64__79rhkp1fndgsc.Appx"
3. *Run the Ubuntu EXE*
Win+R > cmd{control+shift+enter}
C:\> wsl
Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore
C:\> ubuntu1804.exe
Installing, this may take a few minutes...
Please create a default UNIX user account.
The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: {enter any desired uname}
Enter new UNIX password: {enter any desired passwd}
Retype new UNIX password: {re-enter that same passwd}
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
Voila!
To test, run "linux" commands at the "***@pcname:~$" prompt:
$ whoami
uname
$ pwd
/home/uname
$ mkdir foo
$ touch foo/bar.txt
$ cd foo
$ ls
$ vim bar.txt
$ vipw
vipw: Permission denied.
vipw: Couldn't lock file: Permission denied
vipw: /etc/passwd is unchanged
$ sudo vipw
[sudo] password for x: {enter password for uname}
Select an editor. To change later, run 'select-editor'.
1. /bin/nano <---- easiest
2. /usr/bin/vim.basic
3. /usr/bin/vim.tiny
4. /bin/ed
2
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
etc.
$ sudo apt update
2 sudo apt upgrade -y
$ exit
Test it out to see if you can get it back! :)
Win+R > cmd
C:\> wsl
***@pcname:/mnt/c/Users/uname$
As always, please improve so that all benefit from every action.
As always, this general-purpose tutorial is posted for two key reasons:
a. So that others benefit from all efforts, and,
b. So that others can _improve_ upon what is currently documented;
c. That way, even more people benefit from the end result.
Advantage of this 3-step command-line method:
a. It's essentially three cut-and-paste commands, click, click, & click.
b. No privacy leaks (i.e., no login, no Microsoft Store!)
c. You should be up and running in a few minutes.
Disadvantages of this method:
A. This tutorial doesn't cover adding Ubuntu 20.04 yet (I don't know how).
B. This tutorial doesn't cover enabling graphical applications yet.
C. This tutorial doesn't cover enabling sound (pulse audio) yet.
Thanks to Mike Easter for pointing to the fundamental documentation.
<https://wiki.ubuntu.com/WSL>
Given that documentation, here are the 3 cut-and-paste command-line steps:
1. Download the Ubuntu APPX
2. Add the Ubuntu APPX
3. Run the Ubuntu EXE
1. *Download the Ubuntu APPX*
<https://wsldownload.azureedge.net/CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2018.817.0_x64__79rhkp1fndgsc.Appx>
Name: CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2018.817.0_x64__79rhkp1fndgsc.Appx
Size: 224629284 bytes (214 MiB)
SHA256: 96E4E3E336F08DDE1DF81FA9C266C5C7750BA92729857E92BDE36BF84A1DB002
Note: If you can find the Ubuntu 20.04 appx, please advise of the URL.
2. *Add the Ubuntu APPX*
Win+R > powershell
PS> Start-Process powershell -verb runAs
PS> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
PS> Add-AppxPackage -Path "C:\software\iso\ubuntu\CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2018.817.0_x64__79rhkp1fndgsc.Appx"
3. *Run the Ubuntu EXE*
Win+R > cmd{control+shift+enter}
C:\> wsl
Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore
C:\> ubuntu1804.exe
Installing, this may take a few minutes...
Please create a default UNIX user account.
The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: {enter any desired uname}
Enter new UNIX password: {enter any desired passwd}
Retype new UNIX password: {re-enter that same passwd}
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
Voila!
To test, run "linux" commands at the "***@pcname:~$" prompt:
$ whoami
uname
$ pwd
/home/uname
$ mkdir foo
$ touch foo/bar.txt
$ cd foo
$ ls
$ vim bar.txt
$ vipw
vipw: Permission denied.
vipw: Couldn't lock file: Permission denied
vipw: /etc/passwd is unchanged
$ sudo vipw
[sudo] password for x: {enter password for uname}
Select an editor. To change later, run 'select-editor'.
1. /bin/nano <---- easiest
2. /usr/bin/vim.basic
3. /usr/bin/vim.tiny
4. /bin/ed
2
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
etc.
$ sudo apt update
2 sudo apt upgrade -y
$ exit
Test it out to see if you can get it back! :)
Win+R > cmd
C:\> wsl
***@pcname:/mnt/c/Users/uname$
As always, please improve so that all benefit from every action.
--
The great benefit of the public Usenet potluck is we learn from each other.
The great benefit of the public Usenet potluck is we learn from each other.