Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save abdilahrf/c885bc4c46b74d21bd2a6acd4582ad3d to your computer and use it in GitHub Desktop.
Save abdilahrf/c885bc4c46b74d21bd2a6acd4582ad3d to your computer and use it in GitHub Desktop.

Revisions

  1. @xynova xynova revised this gist Apr 29, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Enable WSL and Ubuntu 16.04 on Windows 10.md
    Original 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 terminal:
    You can manage the Ubuntu instance from a Powershell session:

    ```Powershell
    ubuntu.exe /?
  2. @xynova xynova revised this gist Apr 29, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Enable WSL and Ubuntu 16.04 on Windows 10.md
    Original file line number Diff line number Diff line change
    @@ -64,7 +64,7 @@ password123
    # See "man sudo_root" for details.
    ```

    Now you are in an ubuntu session:
    You are now in an ubuntu session:

    ```
    # ubuntu@windows10:~$
    @@ -86,7 +86,7 @@ EOF

    ### Managing distro

    You can manage the ubutnu instance from a Powershell terminal:
    You can manage the Ubuntu instance from a Powershell terminal:

    ```Powershell
    ubuntu.exe /?
  3. @xynova xynova revised this gist Apr 26, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Enable WSL and Ubuntu 16.04 on Windows 10.md
    Original 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
    #### 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
    ### Managing distro

    You can manage the ubutnu instance from a Powershell terminal:

  4. @xynova xynova revised this gist Apr 26, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Enable WSL and Ubuntu 16.04 on Windows 10.md
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@
    # Enable WSL and Ubuntu 16.04 on Windows 10
    ## 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
    ### Install and setup

    Open Powershell in Administrator mode and enable WSL (Needs a computer restart):

  5. @xynova xynova renamed this gist Apr 26, 2019. 1 changed file with 0 additions and 0 deletions.
  6. @xynova xynova revised this gist Apr 26, 2019. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions enable-wsl-and-ubuntu-1604.md
    Original 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.
  7. @xynova xynova revised this gist Apr 26, 2019. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions enable-wsl-and-ubuntu-1604.md
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@
    ## Enable WSL and Ubuntu 16.04
    # 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
    ## Install and setup

    Open Powershell in Administrator mode and enable WSL (Needs a computer restart):

    @@ -82,7 +82,7 @@ EOF
    ```


    #### Managing distro
    ## Managing distro

    You can manage the ubutnu instance from a Powershell terminal:

  8. @xynova xynova revised this gist Apr 26, 2019. No changes.
  9. @xynova xynova renamed this gist Apr 26, 2019. 1 changed file with 0 additions and 0 deletions.
  10. @xynova xynova revised this gist Apr 26, 2019. 1 changed file with 0 additions and 6 deletions.
    6 changes: 0 additions & 6 deletions Enable WSL on Windows 10.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,3 @@

    Windows10




    ## Enable WSL and Ubuntu 16.04

    **References:**
  11. @xynova xynova created this gist Apr 26, 2019.
    135 changes: 135 additions & 0 deletions Enable WSL on Windows 10.md
    Original 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
    ```