Install & Use WSL2 on Windows 10

Install WSL2

Official guide from Microsoft can be found at here.

So you can turn off the page now:)

  1. Upgrade Windows 10 to education edition or above
    1. Refer to this site to get script to setting activation server to NJU kms.
    2. Or use anything you like to upgrade Windows, for example, a retail product key.
  2. Update Windows to at least Version 1903
  3. Right-click the Windows logo on the status bar and select Windows Powershell (Administrator) and run:
    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  4. Download the Linux kernel update package from here
  5. Open Powershell and run
    wsl --set-default-version 2
  6. Reboot
  7. Install Ubuntu in Microsoft Store
    1. Search for and install Ubuntu
  8. Launch it, you will get a WSL console, type your username and password in it
  9. Change apt source to using vim
    1. sudo vim /etc/apt/sources.list
    2. Type in your password
    3. :%s/
    4. :%s/
    5. :wq
    6. sudo apt update && sudo apt upgrade
  10. Install some useful utilities
    1. See below
    2. (You can introduce some other fancy tools to me)
  11. Enjoy

Or you can try the extremely advanced Arch Linux.

Updating the Windows Console Colors & Fonts

You can download an utility from here.

Run ColorTool.exe with argument -bx will change the color of both cmd and wsl consoles, you may need to set these properties for powershell consoles manually.

Or you can try to use the good-looking Windows Terminal from Microsoft Store.

Fonts for the command line

Probably the only good-looking font available for the command line is Sarasa Gothic(等距更纱黑体), you can get it from here.


You can use zsh, and use oh-my-zsh as it’s plugin manager.

I personally recommend these plugins:

  • zsh-syntax-highlighting
    • git clone ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
  • zsh-autosuggestions
    • git clone ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

And don’t forget to activate them in ~/.zshrc.

I personally use nicoulaj as the theme.

Set proxy

Assume that certain strange program is listening to the port 1083 at localhost.

Add these to ~/.zshrc.

declare winip=$(cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }')
declare http_port=1083
export DISPLAY="${winip}:0"
export ALL_PROXY="http://${winip}:${http_port}"
export http_proxy=$ALL_PROXY
export https_proxy=$ALL_PROXY
if [ "`git config --global --get proxy.https`" != "${ALL_PROXY}" ]; then
        git config --global proxy.https "${ALL_PROXY}"

Write a small script ~/.proxy-wrapper like this, don’t forget to chmod +x ~/.proxy-wrapper.

declare winip=$(cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }')
declare socks5_port=1083

nc -x ${winip}:${socks5_port} -X5 $*

(We use openbsd-netcat here.)

Add these to ~/.ssh/config:

Host github
    User git
    ProxyCommand $HOME/.proxy-wrapper '%h %p'

Add these to ~/.gitconfig

    gitproxy = $HOME/.proxy-wrapper

You can refer to this site and this site for further infomation.


git config --global "Zhihui Zhao"
git config --global ""

You can refer to this site for further infomation.


sudo apt install python-is-python3 python3-pip python3-tk
pip3 install -i pip -U
pip3 config set global.index-url

You can refer to this site for further infomation.

X11 Forward

I recommend using vcxsrv as a X11 server. You can get it from here.

Remember to disable access control, you can refer to this for more info.


I recommend using newest version of TeXLive using images from here. Remember to toggle create symlinks to standard directories before installation.

You can use this template to write your reports and homework.

If you want to directly use fonts installed in Windows, instead of copying them to Ubuntu, you can create /etc/fonts/local.conf as super user and write:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">

to it.

If using Arch Linux, you may want to install texlive-core texlive-extra texlive-langchinese texlive-science texlive-fontsextra texlive-bibtexextra


sudo apt install ruby-full bundler
gem sources --add --remove
bundle config mirror.

You can refer to this for further information.


sudo apt install openjdk-11-jdk openjdk-8-jdk maven

Add these to ~/.m2/settings.xml:

            <name>aliyun public</name>

You can refer to this and this for further information.

Visual Studio Code

Download Visual Studio Code at here.

Install a plugin named Remote - WSL and use it to get access to your WSL2.

Install A LOT OF plugins to write code in different languages happily.