2017-09-17

Running Linux directly in Windows 10

Tools like Cygwin and Babun has made Windows somewhat bearable for people used to the power of Unix, and VirtualBox has enabled us to run a full Linux system in a virtual machine if we want that. Despite all this, I still have a dual boot laptop with Windows 10 and Ubuntu on separate partitions. A shell and ported applications is too weak. A virtual machine is too slow and cumbersome.

A while ago, some surprising new "apps" appeared in Windows App Store: OpenSuSE Leap 42SLES 12 and Ubuntu 16.04 LTS! They all use the Windows Subsystem for Linux (WSL) which allows you to run native ELF binaries on a Windows 10 kernel. So, it's neither ported apps like Cygwin, nor virtualization. It's more like Wine, but in the other direction, and developed by people with full access to the relevant source code.

To install WSL, you need build 16215 or later of Windows 10 on x64, which currently (September 2017) means that you need to join Windows Insider to get a pre-release of Windows 10. No big deal! I went along and installed Ubuntu.

WSL is mainly intended as a developer tool. The idea is not to run Linux production servers on a Windows 10 kernel. I hope it's good enough for me to stop dual booting my laptop, and give the whole disk to Windows.

I now have an "Ubuntu" app in the Windows 10 task bar, which provides me with a familiar bash shell, just like Cygwin and Babun does, but here I can run things like apt install docker and a lot of things I could never do in Cygwin or Babun, without the sluggishness and complications of virtualization.

To run Linux GUI programs, the simplest approach is probably to install Xming in Windows, and export DiSPLAY=:0 in Ubuntu. By default that gives you a US keyboard in X, but I wrote a blog post about fixing that.

WSL does not support the docker server, but with a docker server running in Windows, you can use the docker command to run client tasks in Ubuntu. Something like docker run -it alpine sh works as intended. I wrote a separate blog entry about getting docker working.

Will I drop the Linux partition on my laptop SSD and be happy with only Windows 10 on my laptop? I don't know yet, but I'm optimistic.

No comments:

Post a comment