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
posted @   禾几元  阅读(3679)  评论(0编辑  收藏  举报
编辑推荐:
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
· 使用C#创建一个MCP客户端
点击右上角即可分享
微信分享提示