Installing WSL

2020, Dec 30    

Recently I built up a new personal PC via scratch, since the primary operation system has been chosen to be windows since the PC needs to be used by all family members. I have tried to install and configured the WSL(windows subsystem for linux) to make it friendly to me so I can still use those tools and commandline scripts in my linux environment. Here are some tips and tricks I learned in order to make it work properly.

Macbook

Linux Subsystem Installation

The installation is quite straight forward itself, microsofy provides comprehensive instruction on how to find a suitable linux distribution and install it from the Microsoft Store.

The trouble I found was, during the installation process, user can not choose where the linux distribution subsystem will be installed and the default installation directory is the boot disk which there is almost no further storage space.

In order to move your WSL to some other places instead of the boot disk, the tool lxrunoffline is used:

choco install lxrunoffline

Then execute the export and import command to mv the WSL to some other places. For my case, I am moving it to the E: drive.

 lxrunoffline move -n Ubuntu -d e:\wsl\installed\Ubuntu

Prepare for rest of the tools

  • VS Code compatibility: VS Code provide useful plugin to support the embedded comand terminal connected to the WSL environment. Simply refer to the guide provided by VS Code and install the vs-code wsl plugin.

  • Synchronize all the projects: Currently I am having around 50 personal github repositories, some of which are personal projects and some of which are notes or coursework materials. By using Meta.js all the repos and the way how your want to organize them can be put under the .meta file of a centralized github repo. Simply execute the command of meta git clone ${your meta git file address} then you can synchronize all the repos at once to your new location.

samuelzhaoy@DESKTOP-CS6SPRF:~/private/central-repo$ cat .meta 
{
    "projects": {
        "../ios/emojikeyboard": "https://github.com/SamuelZhaoY/ios-emojikeyboard",
        "../ios/framework-template": "https://github.com/SamuelZhaoY/ios-universal-library-framework-template",
        "../study/blog": "https://github.com/SamuelZhaoY/SamuelZhaoY.github.io",
        "../study/notes": "https://github.com/SamuelZhaoY/study-notes",
        "../study/readings": "https://github.com/SamuelZhaoY/readings",
        "../education/nus-soc": "git@github.com:SamuelZhaoY/nus-soc.git",
        "../education/assignments/cs5223-01": "https://github.com/SamuelZhaoY/CS5223-Assignments-01",
        "../education/assignments/cs5223-02": "https://github.com/SamuelZhaoY/CS5223-Assignment-2",
    ...
    }
}
TOC