In this post, I record how to install Ubuntu 16.04 in Windows 10 using Windows Subsystem for Linux.
Open PowerShell as Administrator and use the following command.
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Restart Windows if asked.
You can download the distro from https://aka.ms/wsl-ubuntu-1604. At the time of writing this post, the file I downloaded is Ubuntu.1604.2017.711.0_v1.appx
.
It is also possible to download the file using PowerShell
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile Ubuntu.appx -UseBasicParsing
Once I have downloaded Ubuntu.1604.2017.711.0_v1.appx
, in PowerShell, I use
Rename-Item .\Ubuntu.1604.2017.711.0_v1.appx .\Ubuntu.1604.2017.711.0_v1.zip
Expand-Archive .\Ubuntu.1604.2017.711.0_v1.zip C:\Users\[your-windows-username]\Ubuntu # or pick any folder you like
Replace [your-windows-username]
with your Windows username.
Next, move to C:\Users\[your-windows-username]\Ubuntu
and run ubuntu.exe
to initialize the new distro.
Finally, add C:\Users\[your-windows-username]\Ubuntu
to the Windows environment PATH
using PowerShell
$userenv = [System.Environment]::GetEnvironmentVariable("Path", "User")
[System.Environment]::SetEnvironmentVariable("PATH", $userenv + "C:\Users\[your-windows-username]\Ubuntu", "User")
/etc/sudoers
Suppose that your Ubuntu’s username is username
, then add username ALL=(ALL:ALL) ALL
to /etc/sudoers
.
In CMD, use
ubuntu.exe config --default-user username
One can replace the default Ubuntu mirror http://archive.ubuntu.com/ubuntu/
in /etc/apt/sources.list
with others. See Official Archive Mirrors for Ubuntu.
Before installing Vanilla TexLive as instructed here, use
sudo update-alternatives --set fakeroot /usr/bin/fakeroot-tcp
See this instruction, or simply download this ZIP archive, unzip, and double-click the Add Bash to Your Context Menu.reg
file to get the context menu option. Double-click the Remove Bash From Your Context Menu.reg
file to remove the option.
See this page for more details.
sudo umount /mnt/c
sudo mount -t drvfs C: /mnt/c -o metadata,uid=1000,gid=1000,umask=22,fmask=111 # the default user that gets created when WSL is first installed has a uid=1000 and gid=1000