WSL

WSL的安装及配置

1. 自定义安装位置

  1. download LxRunOffline release ver from https://github.com/DDoSolitary/LxRunOffline then unzip

  2. download appx ver linux package from https://docs.microsoft.com/en-us/windows/wsl/install-manual

  3. change package from .appx to .zip then unzip

  4. install wsl with

    1
    $LxRunOffline.exe install -n Ubuntu -d A:\wsl -f C:\Users\lijiong\Desktop\Ubuntu_1604.2019.523.0_x64\install.tar.gz
  5. use cmd command wsl to open

ps. this method may cause some damage and can’t open browsers in ubuntu, I then tried put Ubuntu.zip in other disk and run Ubuntu.exe, it may work ,wait for update.

2. Add user

​ WSL has a default root user, you‘d better add your own user to prevent damage from mis-operation. Every time you open WSL, manually switch to your own user.

3.更换清华源

1
2
3
4
5
6
7
wget https://tuna.moe/oh-my-tuna/oh-my-tuna.py

python oh-my-tuna.py -h (h for help)

python3 oh-my-tuna.py -g (g for gobal)

apt-get update

4. xfce4+VNC图形界面

1
2
3
4
5
6
7


apt-get install vnc4server

apt-get install xfce4

vncserver

修改root(or username)\.vnc\xstart文件

1
2
3
4
5
6
7
8
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey

重启vncserver

win10VNC连接127.0.0.1:5901

————————————7.22 update————————————

安装anaconda后 由于conda init操作导致系统python版本与VNC4server不兼容,将~/.bashrc部分修改,只保留必要功能即可解决。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
#
export PATH="$PATH:/home/lijiong/anaconda3/bin"
conda activate base
#__conda_setup="$('/home/lijiong/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
#if [ $? -eq 0 ]; then
# eval "$__conda_setup"
#else
# if [ -f "/home/lijiong/anaconda3/etc/profile.d/conda.sh" ]; then
# . "/home/lijiong/anaconda3/etc/profile.d/conda.sh"
# else
# export PATH="/home/lijiong/anaconda3/bin:$PATH"
# fi
#fi
#unset __conda_setup