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
git clone https://github.com/DamionGans/ubuntu-wsl2-systemd-script.git
cd ubuntu-wsl2-systemd-script/
bash ubuntu-wsl2-systemd-script.sh
- 重启子系统
安装桌面环境
sudo apt install ubuntu-desktop && sudo apt install -y xrdp
安装桌面套件和xrdp服务systemctl status xrdp
查看是否正常运行起来sudo adduser xrdp ssl-cert && sudo systemctl restart xrdp
重启xrdp并开放sudo ufw allow 3389
开启默认的3389端口- 然后使用自带的远程桌面软件,ip填写
localshot:3389
就ok - 每次开机都需要
sudo systemctl start xrdp
总结
用起来好卡。。不爽的很
参考
- wsl2 ubuntu Gnome 桌面 https://www.cnblogs.com/zbseoag/p/13851439.html 【最有用!】
- 使用xshell登录ubuntu on windows(wsl) https://www.jianshu.com/p/039411d2c1f6
- Linux 之 .bashrc 文件作用 https://www.cnblogs.com/midworld/p/11006967.html
- 安装Ubuntu子系统 – 以及安装带有Unity的图形化界面 https://www.daniao.org/5258.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· 周边上新:园子的第一款马克杯温暖上架
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
· 使用C#创建一个MCP客户端