Wednesday, October 30, 2019

[Windows] Set up Linux subsystem on Windows 10

This is my first blog post after I left grad school! Time flies. Can't believe I started my new job for a month already. Blogging is still the best way for me to mark down and share learning experiences. So, in the next couple weeks, I plan to write about the set up of my current working environment in series.   

In my new position, I am assigned a PC work computer! At the beginning, I was not happy because I work with Linux a lot and Mac's OSX is coherent with Linux. And I haven't used Windows for many years, so it takes time to adjust to a new set of tools. To my surprise, I found myself take it pretty well so far and even love it because some programs (especially office suites) on Windows seem to have more functionalities!

I don't even know there is an embedded Linux system until I came across this great tool - Windows Subsystem for Linux. It is something close to "Terminal" in Mac but a very different concept. WSL is more like a function rather than a actual program. Once you turn on this function, you are free to install different types of Linux system as a "subsystem", while "Terminal" in Mac is essentially no different than the Mac operation system OSX.

Following this guide (Install WSL on WIN10) on the official website, I successfully enabled this function on my Windows 10 and was able to use the Microsoft store. I selected Ubuntu 16.04 because of its popularity and user-friendliness. And the reason to go for 16.04 only because it is more stable. I have used Centos, Fedora, and Ubuntu before. The major differences are the admin commands and the package management platforms. Ubuntu has a larger user community as well. If you are new to Linux, you will find more topics and discussions online.

Once Ubuntu 16.04 is installed, I opened the terminal (referring to as the command-line window, not the program in Mac) and found the default theme very unreadable. The text colors of the file system and within the scripts are fighting with each other. I tried to adjust the colors to make it like the original Ubuntu following this post: make-bash-on-ubuntu-on-windows-10-look-like-the-ubuntu-terminal

It looked much better, but I was not satisfied. Technically, the Ubuntu 16.04 is an app on my Win10. Every time I open a new terminal window, I have to either double-click or right-click on the Ubuntu icon. If you have 5 separate tasks, you have to open five windows and have a hard time to locate the right one immediately. I missed the gnome-terminal, where you can manage different windows in tabs. So I looked for a simple external program to do that. 

It turns out the "Windows Terminal" do a sufficient job. It is fresh and was launched on the Microsoft Store in June. I am able to open multiple "subsystem" through this one small program, and open as many tabs as I want. Finally, I customized my Windows Terminal following this guide: windows-terminal. By setting this up, I got a chance to learn the JSON format, a commonly used format in JavaScript. One thing I want to complain is the name of this program. Can Microsoft be more creative on names? "Windows Terminal", "PowerShell"... Although these names seem to make it easy to connect them to the Apple or Linux counterpart, but they also make it difficult to google their tutorials and tips online! 

So far, I am happy with the "WSL-Ubuntu" and "Windows Terminal" combination. In the next blog, I will talk about the editors I use on Windows 10.



No comments:

Post a Comment