Forked from xynova/Enable WSL and Ubuntu 16.04 on Windows 10.md
Created
December 8, 2022 13:51
-
-
Save abdilahrf/c885bc4c46b74d21bd2a6acd4582ad3d to your computer and use it in GitHub Desktop.
Revisions
-
xynova revised this gist
Apr 29, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -86,7 +86,7 @@ EOF ### Managing distro You can manage the Ubuntu instance from a Powershell session: ```Powershell ubuntu.exe /? -
xynova revised this gist
Apr 29, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -64,7 +64,7 @@ password123 # See "man sudo_root" for details. ``` You are now in an ubuntu session: ``` # ubuntu@windows10:~$ @@ -86,7 +86,7 @@ EOF ### Managing distro You can manage the Ubuntu instance from a Powershell terminal: ```Powershell ubuntu.exe /? -
xynova revised this gist
Apr 26, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -35,7 +35,7 @@ ubuntu # Installing, this may take a few minutes... ``` #### Setup your default user The first user account you create is automatically (https://aka.ms/wslusers) configured with a few special attributes: - It is your default user -- it signs-in automatically on launch. @@ -84,7 +84,7 @@ EOF ``` ### Managing distro You can manage the ubutnu instance from a Powershell terminal: -
xynova revised this gist
Apr 26, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ ## Enable WSL and Ubuntu 16.04 on Windows 10 **References:** - https://docs.microsoft.com/en-us/windows/wsl/install-win10 - https://docs.microsoft.com/en-us/windows/wsl/install-manual - https://docs.microsoft.com/en-us/windows/wsl/user-support - https://docs.microsoft.com/en-us/windows/wsl/wsl-config ### Install and setup Open Powershell in Administrator mode and enable WSL (Needs a computer restart): -
xynova renamed this gist
Apr 26, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
xynova revised this gist
Apr 26, 2019 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -35,6 +35,8 @@ ubuntu # Installing, this may take a few minutes... ``` ### Setup your default user The first user account you create is automatically (https://aka.ms/wslusers) configured with a few special attributes: - It is your default user -- it signs-in automatically on launch. - It is Linux administrator (a member of the sudo group) by default. -
xynova revised this gist
Apr 26, 2019 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ # Enable WSL and Ubuntu 16.04 on Windows 10 **References:** - https://docs.microsoft.com/en-us/windows/wsl/install-win10 - https://docs.microsoft.com/en-us/windows/wsl/install-manual - https://docs.microsoft.com/en-us/windows/wsl/user-support - https://docs.microsoft.com/en-us/windows/wsl/wsl-config ## Install and setup Open Powershell in Administrator mode and enable WSL (Needs a computer restart): @@ -82,7 +82,7 @@ EOF ``` ## Managing distro You can manage the ubutnu instance from a Powershell terminal: -
xynova revised this gist
Apr 26, 2019 . No changes.There are no files selected for viewing
-
xynova renamed this gist
Apr 26, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
xynova revised this gist
Apr 26, 2019 . 1 changed file with 0 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,3 @@ ## Enable WSL and Ubuntu 16.04 **References:** -
xynova created this gist
Apr 26, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,135 @@ Windows10 ## Enable WSL and Ubuntu 16.04 **References:** - https://docs.microsoft.com/en-us/windows/wsl/install-win10 - https://docs.microsoft.com/en-us/windows/wsl/install-manual - https://docs.microsoft.com/en-us/windows/wsl/user-support - https://docs.microsoft.com/en-us/windows/wsl/wsl-config #### Install and setup Open Powershell in Administrator mode and enable WSL (Needs a computer restart): ```Powershell Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux ``` Download Ubutnu 16.04 (16.04 has been patched for over a year): ```Powershell Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile Ubuntu.appx -UseBasicParsing ``` Open Powershell in Administrator mode and install the downloaded package: ```Powershell Add-AppxPackage .\Ubuntu.appx ``` Now type the following in on the terminal: ```Powershell ubuntu # Installing, this may take a few minutes... ``` The first user account you create is automatically (https://aka.ms/wslusers) configured with a few special attributes: - It is your default user -- it signs-in automatically on launch. - It is Linux administrator (a member of the sudo group) by default. Type in a Linux username and password for the user. **NOTE:** You will need this password to perform `sudo` commands (dont loose it): ```Bash # Installation successful! # 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: ubuntu # Enter new UNIX password: password123 # Retype new UNIX password: password123 # passwd: password updated successfully # Default UNIX user set to: ubuntu # To run a command as administrator (user "root"), use "sudo <command>". # See "man sudo_root" for details. ``` Now you are in an ubuntu session: ``` # ubuntu@windows10:~$ ``` Having to enter a password when executing sudo commands is a pain so lets remove that. **Note** that this is based on the default user being named `ubuntu`. ```Bash sudo su # [sudo] password for ubuntu: cat<<EOF > /etc/sudoers.d/ubuntu && chmod 0440 /etc/sudoers.d/ubuntu ubuntu ALL=(ALL) NOPASSWD:ALL EOF ``` #### Managing distro You can manage the ubutnu instance from a Powershell terminal: ```Powershell ubuntu.exe /? # Launches or configures a linux distribution. # # Usage: # <no args> # - Launches the distro's default behavior. By default, this launches your default shell. # # run <command line> # - Run the given command line in that distro, using the default configuration. # - Everything after `run ` is passed to the linux LaunchProcess call. # # config [setting [value]] # - Configure certain settings for this distro. # - Settings are any of the following (by default) # - `--default-user <username>`: Set the default user for this distro to <username> # # clean # - Uninstalls the distro. The appx remains on your machine. This can be # useful for "factory resetting" your instance. This removes the linux # filesystem from the disk, but not the app from your PC, so you don't # need to redownload the entire tar.gz again. # # help # - Print this usage message. ``` You can also enter an ubuntu shell from other terminal emulators like `Powershell` or `cmd` by typing `ubuntu`: ```Powershell ubuntu # root@windows10:~# ``` You can also change the default user if you want to change it from your previously created one: ```Powershell ubuntu config --default-user ubuntu ```