WSL2+Ubuntu20.04桌面功能配置

WSL2+Ubuntu20.04桌面功能配置

能使用系统自带的远程桌面就使用这个,子系统是重装后干净的系统

使用清华的软件源mirrors.tuna.tsinghua.edu.cn,备份软件源?不存在的

#  sudo vi /etc/apt/sources.list                 use `:%d` command  empty file contents 
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse

添加完还是要记得apt update;apt upgrade更新并且升级下包

其次就是WSL自带的SSH有点的问题,要remove并重新install,然后修改配置文件中的端口并重启ssh服务 ,

因为默认的是22端口,但是windows的ssh服务默认也是22端口(如果不用Windows Terminal的话)。

sudo apt autoremove --purge openssh-server -y && sudo apt install openssh-server -y
sudo service ssh --full-restart

虚拟套件:ubuntu-desktop 2000MB+!!

解决WSL2不支持 systemd

  1. git clone https://github.com/DamionGans/ubuntu-wsl2-systemd-script.git
  2. cd ubuntu-wsl2-systemd-script/
  3. bash ubuntu-wsl2-systemd-script.sh
  4. 重启子系统

安装桌面环境

  1. sudo apt install ubuntu-desktop && sudo apt install -y xrdp 安装桌面套件和xrdp服务
  2. systemctl status xrdp查看是否正常运行起来
  3. sudo adduser xrdp ssl-cert && sudo systemctl restart xrdp 重启xrdp并开放
  4. sudo ufw allow 3389 开启默认的3389端口
  5. 然后使用自带的远程桌面软件,ip填写localshot:3389 就ok
  6. 每次开机都需要sudo systemctl start xrdp

总结

用起来好卡。。不爽的很

参考

  1. wsl2 ubuntu Gnome 桌面 https://www.cnblogs.com/zbseoag/p/13851439.html 【最有用!】
  2. 使用xshell登录ubuntu on windows(wsl) https://www.jianshu.com/p/039411d2c1f6
  3. Linux 之 .bashrc 文件作用 https://www.cnblogs.com/midworld/p/11006967.html
  4. 安装Ubuntu子系统 – 以及安装带有Unity的图形化界面 https://www.daniao.org/5258.html
原文地址:https://www.cnblogs.com/somegenki/p/14042490.html