Getting Linux on Windows 10 with WSL - Some basic installation instructions, pitfalls, and comments.

Getting Linux on Windows 10 with WSL - Some basic installation instructions, pitfalls, and comments.

The other day, @Alex Buerkle brought to my attention that Window’s 10 is now Linux-capable, such that anyone with the Fall Creator’s update can install a very light form of Linux (e.g., Ubuntu), without having to partition their drive. That is, the Windows Subsystem for Linux (WSL) can be activated, allowing one access to a Linux Terminal. As someone that has created dual boot machines before (not for a while, so I’ve forgotten everything), this sounded magical, as I recall the process being a serious pain in the butt. However, I just installed WSL with Ubuntu and R in about an hour (okay, maybe two, because I had to trouble shoot the R installation – see below), and thought I’d share some resources and comments, in case anyone else wanted to do something similar.

So, the easiest part of this whole process was activating WSL and then installing Ubuntu. This legitimately took 15 minutes. To do that, I followed these instructions: http://blog.revolutionanalytics.com/2017/12/r-in-the-windows-subsystem-for-linux.html.

Oddly, the hardest part was setting up the install so that I could load R. Not sure if I was making it harder on myself or not, but when I got to the part about the key in the link above, I didn’t really know what was going on (still kinda don’t, but hey, it works). However, I was able to find a site that provided guidance on how to setup a key, which was surprisingly complicated. Here is the site: http://packaging.ubuntu.com/html/getting-set-up.html.

One of the weirdest parts of setting up the package system was having to register my key with launchpad.net, as outlined in the link immediately above. Part of this process required me to upload a verification value to launchpad via a txt file I’d saved to my computer, so I had to interact with Window’s files system from Ubuntu. Eventually I figured out that /mnt/c/RWorkspace/texty.txt is equivalent to C:\RWorkspace\texty.txt in Ubuntu and Windows, respectively.

At one point, when I was trying to paste in my key to register it, I got an error about not having access to dirmngr. Eventually it went away, but I’m not sure if that was because I’d properly registered my key at that point, or because I ran some code from this GitHub issue. Sharing, in case it is useful.

Other than that, the install was pretty smooth! And I now have an Ubuntu terminal on my Windows machine, where I can happily type up command line R, or run R scripts from the command line.

One weird thing about working with terminal in Windows, that I think is worth mentioning, is pasting text. I can’t just ctrl+v to paste something I’ve copied elsewhere. Instead you have to right-click wherever you want to paste some text. Apparently there is good reason for this behavior, but I find it odd. Copying works the same as normal (ctrl+c). Happy coding!