Giter Site home page Giter Site logo

michaeltreat / windows-subsystem-for-linux-setup-guide Goto Github PK

View Code? Open in Web Editor NEW
616.0 616.0 98.0 246 KB

An in-depth Guide for getting started with the Windows Subsystem for Linux!

License: MIT License

linux linux-setup microsoft tutorial ubuntu windows-subsystem wsl

windows-subsystem-for-linux-setup-guide's People

Contributors

akshayagarwal avatar alferguson avatar awhlam avatar brookr avatar chrisjwelly avatar duncan avatar hh-shiung avatar izzybaer avatar michaeltreat avatar ncaudill27 avatar parius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

windows-subsystem-for-linux-setup-guide's Issues

Where to write code?

Hello WSL community,
I am am new to WSL and found this setup guide extremely helpful.
My questions is where should I be writing my code? I thought I could write my code in Windows editor and run this code in Ubuntu, but when I have tried that linux complains about /r in my code.
.../ncbi-blast.sh: line 8: syntax error near unexpected token $'do\r''`

In your setup guide you install VCode; however, I am accustomed to using Atom. So, I wrote my code in Atom on windows.
Any and all help would be appreciated.
Thank you!

Can't connect to mongo Db

A student had an issue trying to connect to the psql DB.

When the student would try to launch the db, she was getting an authorization error. We double checked her constring and manually logging into the psql shell to verify that her username and passwd were correct. We were not able to solve the bug before she had to go into lecture.

Later, she mentioned that something about 'nodemon' was out of date, and had to use "chown" command to change the owner, and that fixed her bug.

This is a one-off so far, but I documented it in the event it happens again.

[P2][Installs]Update for 'Install PostgreSQL using WSL'

In section Install, line 3,
For ubuntu 18.04, it should be
deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main
for 16.04, is
deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main
for 14.04, is
deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main

reference

Open Source Call!

This guide's mission is to make WSL accessible to new and experienced developers alike, in a fast and in-depth format.

This is an open invitation to everyone to create issues, correct mistakes and misinformation, and to contribute in any way they can to help improve this guide!

Personally, as both a new dev and an experienced dev, I have found it frustrating when reading a guide or article that doesn't go in-depth on the topic that it is covering. If I want to learn about something (and I'm not reading the docs ) I want to know the how's AND the why's of everything. I find it a better use of my time to read something that is written in an in-depth format from the start as it is structured in such a way as to cover everything from end-to-end, and I don't have to piece together many different articles to get a full picture.

On the other hand, the short, to-the-point guides are also incredibly useful for when I just want to get something done. That is why I have tried to write this guide in such a way that a developer of any skill can come in and find exactly what they need.

So, these are the guidelines I am keeping in mind when writing this guide:

  • Assume the person reading the guide has no idea about the topic. Include everything you think they should know.
  • Keep the beginning dev in mind at all times. Everyone is a beginner. Some just have more practice at it.
  • Be thorough. Whenever possible explain how AND why. If you don't know both, then look it up, or make it clear you don't know the why.
  • Include use-cases. Use analogies and scenarios to explain concepts. Knowledge vs wisdom. Knowing how vs knowing when.

If you would like to contribute then please try to follow these guidelines so we can keep this guide consistent and accessible to everyone!

Updating Terminal

I'm running into an issue after updating .profile.
I replace the default profile code with the code you provide.
Then I close the terminal. Then restart Ubuntu.

When I do so, the terminal hangs. There is never any prompt.
CPU usage quickly skyrockets to 100%. - Mostly Git.
Closing the terminal, returns CPU back to normal.

I've uninstalled, re-installed Ubuntu (WSL) few times ( in case I caused a typo that broke the .profile file ).
I've double checked the .profile code.

Each time, after updating Terminal's look, Ubuntu essentially breaks.
The terminal is unresponsive upon open.
CPU (via git) immediately shoots up to 100%.

Any hints ideas ?
I'm using the latest version of Windows 10.

WSL2 update?

Any new version of this documentation coming soon? targeting WL2?

Screencast Blurry

Kudos Mike on helping folks get WSL setup. I think that is great that you both provide shortcuts and long form context. I just wanted to give you a heads up... it looks like there are some sections of your Explainer Videos that are coming across as Blurry. For example in your third WSL Video -- you have a blurry section that spans from approx. Timecode: 29:17-31:07.

I know you were trying to present the whole thing from A-Z (real-world, real-time) ... which is also really helpful to folks learning. However, in this context, instead of doing the whole shebang over again... maybe you can just splice in the corrected Vid section ala this is what I am/was doing on the Command Line, etc. Again, thank you for helping others.
help_michael_treat_wsl_vid_issue_blurry

No Dirmngr

I tried to run the second step of the installation tutorial but it ended with the following error.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
Executing: /tmp/apt-key-gpghome.voA0lZRTwz/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
gpg: connecting dirmngr at '/tmp/apt-key-gpghome.voA0lZRTwz/S.dirmngr' failed: IPC connect call failed
gpg: keyserver receive failed: No dirmngr

[P0][Concept][Content] NPM pathing with WSL

Synopsis:

Pathing from Windows FS to Linux FS is not hierarchical, breaking NPM's functionality when it tries to use globally installed packages on the Windows FS. As such, it is recommend to add a package.json to a top-level directory at or directly up the tree from where all coding work is held. This will allow you to install packages at this level to act as the Windows global package install location. This also requires navigating to that top-level directory when you wish to install something globally on the Windows FS, as the -g flag would install it on the Linux side.

Explanation:

When using WSL, Node's NPM pathing can break down as NPM looks UP a given file structure tree for a directory called node_modules, and then looks into that directory for the specific package. If the package is not there, it continues to look up the tree until it has reached the top of the FS tree, at which point it stops.

With the WSL feature, the two overall FS trees ( Linux and Windows) are connected, but are NOT hierarchical. One is not above the other, they are mounted together in a different area. As such, when you install a package with the -g flag, it will be put into the Linux FS, and as the Windows side looks for it, it will never reach that location.

In addition, when you install something with the -g flag, it will be the Linux version of it because the default location for -g is on the Linux side, so even if Windows could look that way, it likely wouldn't be able to use it. This means that programs that either need access to a package, need a package to be a Windows version, or both, typically cannot use anything under the -g default location.

A solution for this is to create an NPM package.json at the top-level of the Windows directory that contains all of your dev work and projects ( or anything directly up the tree from it ). This npm package should be treated as and will act as the Windows's unofficial "global" location. Note: This will not change the -g flag's default location, and you shouldn't change it either. You will have to manually move to this location when you want to install something here.

This allows any of your projects ( which are directly below it) to look up their file structure tree and eventually find a "globally" installed package just like normal. In addition, NPM will install the package's appropriate OS version.

Workflow:

The workflow change really only requires a one time extra step of adding the package.json to the Windows FS, and then knowing where and how to install different packages:

I usually install shell utilities such as nodemon, live-server, and other software I want run in a Linux environment by using the -g flag. These are things that won't be needed on the Windows side. Anything else will go on the Windows side.

IE: sudo npm install -g live-server // Can be executed from anywhere.

Anything that I want to be "global" on the Windows side, like eslint, and a default .eslintrc, or other VSCode extensions`, I install at the top-level Windows FS directory that holds all of my dev work. That way the package is added to the node_modules at that level and not at the project level.

IE: cdwr then npm install eslint // the npm install <package> must be executed at the top-level location in order for it be added to that level's node_modules, and for it to act as a "global" package for all other projects below it.

Then, as I work on a given project, I install any of it's package dependencies at the project level like a normal flow would.

IE:

  1. npm install <package> // Executed at the project level to add to that project's dependencies.

Summary:

One time setup:

  1. Install Node on Linux distro.
  2. Navigate to the top-level of your directory containing all of your code work. IE : /Users/<user>/coding/
  3. Once there, type npm init -y to create a basic package.json.

Workflow:

  1. When you want to install a package that is not needed on Windows, use the -g flag.
  2. Otherwise, install it at the top-level of your coding directory...
  3. Unless it's project specific, which should be installed wherever that project's package.json is location at.

Note:
I wouldn't worry about adding an alias for this specifically either. Your top-level directory should already be under cdwr or near it ( if you followed the WSL pre-work) so you can navigate to it easily, and you will likely be installing most global packages once, and early on, dropping rapidly in frequency as time goes on. In other words, you likely only need to install something globally a couple times, so it's not worth bloating your .profile with an alias command that you likely will not need to use that often.

Re-open WSL after Updating its Profile

In 04_updating_terminal.md after step 5 of saving the changes made to profile, there should be a step that tells the user to close and open the WSL terminal to see their changes. If one does not reopen their WSL, the cdwr command does not work.

Note, I have not tested this out on other machines and only have done it once. Thank you.

wsl colse with error 0 and close unexpectedly .

2020-06-21 03:48:27.131] Resolving wsl+docker-desktop, resolveAttempt: 1
[2020-06-21 03:48:27.203] Starting VS Code Server inside WSL (docker-desktop)
[2020-06-21 03:48:27.203] Extension version: 0.44.4, Windows build: 19041. Multi distro support: available. WSL path support: enabled
[2020-06-21 03:48:27.376] Probing if server is already installed: C:\Windows\System32\wsl.exe -d docker-desktop -e sh -c "[ -d ~/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d ] && printf found || ([ -f /etc/alpine-release ] && printf alpine-; uname -m)"
[2020-06-21 03:48:27.616] Probing result: found
[2020-06-21 03:48:27.617] Server install found in WSL
[2020-06-21 03:48:27.619] Launching C:\Windows\System32\wsl.exe -d docker-desktop sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" cd9ea6488829f560dc949a8b2fb789f3cdc05f5d stable .vscode-server 0 ' in c:\Users\nithi.vscode\extensions\ms-vscode-remote.remote-wsl-0.44.4}
[2020-06-21 03:48:27.989] Setting up server environment: Looking for /root/.vscode-server/server-env-setup. Not found.
[2020-06-21 03:48:27.989] WSL version: 4.19.104-microsoft-standard docker-desktop
[2020-06-21 03:48:27.989] WSL2-shell-PID: 1005
[2020-06-21 03:48:27.989] Starting server: /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/server.sh --port=0 --use-host-proxy --enable-remote-auto-shutdown
[2020-06-21 03:48:28.061] /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/server.sh: line 12: /root/.vscode-server/bin/cd9ea6488829f560dc949a8b2fb789f3cdc05f5d/node: not found
[2020-06-21 03:48:28.062] VS Code Server for WSL closed unexpectedly.
[2020-06-21 03:48:28.062] For help with startup problems, go to
[2020-06-21 03:48:28.062] https://code.visualstudio.com/docs/remote/troubleshooting#_wsl-tips

Naming Issue on .profile - User Folder in Windows

Hi Michael,

Thank you for this wonderful guide to WSL. I was wondering if you've encountered the issue on adding space to the user folder under the .profile file.

For example,

export wr=~/../..mnt/c/Users/FirstName LastName/

I've tried googling the issue, some people suggested forward slash \ to handle the spacing issue, but that does not work for me. I've also tried, single quote or double quote.

Example:

export wr=~/../..mnt/c/Users/FirstName\ LastName/
export wr="~/../..mnt/c/Users/FirstName LastName/"
export wr='~/../..mnt/c/Users/FirstName LastName/'

Sincerely, thanks again for your great work.

[P0][Permissions] Incorrect Information - permission restrictions.

Somewhere in the guide, when talking about Permissions, I made it clear that there were not any restrictions around permissions, and that users shouldn't have permission issues out of the box (ootb).

But that's incorrect, at least in my case. With a basic guide setup, users cannot navigate to Cookies or other directories on their User/user path. Can someone please try this on their machine with a basic guide setup and see if it repros? Maybe someone who just got a new machine or can uninstall and reinstall easily?

Essentially, we need to update this section with the incorrect information, and we also need to make sure we include the solution/ workaround here as well, as we were a source of misinformation.

We then need to make sure we clean up and other areas that might be sending that same message, just to make sure we stay consistent throughout the guide.

image

Please help out if you can, and let's use this thread for communication!

Thanks,
Mike

[P1][01_preface.md][Typos][Content] Content enhancements and Questions.typo on the 01_preface.md page

Hi Michael,

There's a typo on the 01_preface.md page (extra word "to"):

There have been many different workarounds for to this problem

should be:

There have been many different workarounds for this problem

Thanks for putting together the article. This WSL is very useful.
It's great for running the "lftp" program, to speed up downloads
from remote servers by using multiple connections, e.g.

lftp -c "mirror --use-pget-n=4 --verbose sftp://username:passwword@hostname/pathname"

Cheers,
Ned.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.