Friday, October 18, 2019

Linux on Windows 10

I finally got to an item on my to-do list to setup the Windows Subsystem for Linux on my Microsoft Surface (v6). You may be wondering why it was so important: as I work on more Python development and utilize Linux more at my day job, I wanted to make my Surface device as usable for this work - as usable as my MacPro. Another caveat is my disdain for the Mac elitists that think any Microsoft device is inferior in every way. On this note, I'll discuss my Edge conversations at a later date.

Adding the Windows Subsystem for Linux feature

There are two ways to enable it on Windows 10, you can use a PowerShell command or use the gui to add the Windows feature.

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Via the Windows gui:

  • Windows System -> Control Panel
  • Programs
  • Turn Windows Feature On/Off
You choose your Linux version, I chose Ubuntu 18.04 as my Linux flavor. For my installation, I had these options:

Once enabled, you can open a Linux command window and do your Linux whatever. Your Linux flavor will now appear in your application list (click the Windows icon to see list), I pinned it to my start screen for easy access.



Once setup, I jumped into Python mode, but I ran into some issues. With Ubuntu, Python is installed by default (you have to use the python3 command to use latest version). However, when I tried to add packages I was told pip was not setup. After some noodling and Googling, I found instructions for updating Ubuntu and installing pip. Here are the commands via this link:

sudo apt-get install software-properties-common
sudo apt
-add-repository universe
sudo apt
-get update
sudo apt
-get install python-pip As with Python, by default you have to use pip version 3 via pip3 command. Once that was setup, I was ready to go with my Python fun - I added packages and configured git (included with Ubuntu).

This allows me seamlessly to do my Python work on my Surface device, MacPro and Linux laptop - it's nice to be fluent with different devices/setups. This is only the tip of the iceberg with Linux on Windows as there are more features/functionality that I'll explore whenever - you can access Windows resources via Linux and vice versa. Has a whole new world opened?

A note to my Mac snobs that are living in the past with their Microsoft bias. While I love my MacPro and it is my primary device, it is worth noting that Microsoft is not the closed system monolith of the past - remember they bought github and have not changed it - as you see with this Windows feature, the many Linux/Unix options on Azure and do not forget the popular cross-platform Visual Studio Code (that is my go to editor on my Mac).

Let's not approach our work with closed minds.

-Farewell.

One update - I was thinking I could easily work with Docker via the Linux command line, but not so fast. It requires Docker installed on Windows and hooks into it, furthermore it requires Windows 10 Pro whereas I have the Home edition (came with my Surface), so I am at a standstill and will rely on other machines for Docker work - or I could just use a VM....