How To Setup Windows Subsystem of Ubuntu and Forwarding its Desktop(Graphics) to Windows

Abstract: This post is a reference article that I have tested working with on a Windows with Ubuntu 18.04. Most posts on the internet about this topic do not work/ lack of updates.

https://www.pcgamer.com/linux-in-windows-10/

Guidelines

  1. Enable the WSL feature in windows.Type in this in a powershell. (you can also disable this feature by goolge how to online)
    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

  2. Install the Ubuntu from windows store App, make sure you select the 18.04 version.

  3. After Ubuntu installed. Open the Ubuntu terminal in windows and do

    sudo apt-get update
    sudo apt-get upgrade
    
  4. Install a GUI. This GUI is the one I found working, although it is not very beautiful.

    • Donwload & Install Xming Here, this is used for display your Ubuntu desktop in windows.
    • Then put this in my bashrc to let the system know that you have the Xming.
    # run xserver
    export DISPLAY=:0.0
    alias xdisplay='dbus-launch --exit-with-session ~/.xsession'
    
  5. Install a desktop(the Graphics windows) in Ubuntu

    sudo apt install xfce4
    sudo apt install gnome-themes-standard
    sudo apt install conky
    
  6. Tweaks
    nano ~/.xinitrc
    Put this inside it.

    #!/usr/bin/env bash
    export LANG="en_US.UTF-8”
    export LC_ALL="en_US.UTF-8”
    exec startxfce4
    

    Run the following

    chmod +x ~/.xinitrc
    ln -s ~/.xinitrc ~/.xsession
    dbuslaunch --exit-with-session ~/.xsession
    
  7. How to use

    • reboot you PC
    • start Xming first
    • type this shortcut in a Ubuntu terminal xdisplay
    • Good to go.

How to disable the terminal beep sound:

Put this into your ~/.inputrc file(create one if not exsist) and re-open the terminal.

set bell-style none