wsl 安装ubuntu gui

wsl windows linux 子系统安装 ubuntu 桌面

1、下载

在windows应用商店 搜索ubuntu18,点击安装。

 

 2.初始化

下载完成后点击打开,会让你输入用户名、密码、确认密码。输入密码是不会显示的,直接输入之后回车就可以。

 

 3.换源

sudo vim /etc/apt/sources.list
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
更新
sudo apt-get update
4.图形界面的配置
WSL 不支持 systemd 而 Gnome 桌面又是基于 systemd,所以先解决这个问题。
sudo apt update
sudo apt install git
git clone https://github.com/DamionGans/ubuntu-wsl2-systemd-script.git
cd ubuntu-wsl2-systemd-script/
bash ubuntu-wsl2-systemd-script.sh
关闭wsl
sudo apt-get update
4.图形界面的配置
WSL 不支持 systemd 而 Gnome 桌面又是基于 systemd,所以先解决这个问题。
sudo apt update
sudo apt install git
git clone https://github.com/DamionGans/ubuntu-wsl2-systemd-script.git
cd ubuntu-wsl2-systemd-script/
bash ubuntu-wsl2-systemd-script.sh
关闭wsl
wsl --shutdown
查看wsl版本
wsl -l -v

 

 如果version 不为2则转换,ubuntu版本根据自己实际版本填写

wsl --set-version Ubuntu-20.04 2
启动wsl
wsl
ubuntu终端中输入:
systemctl
确认能正常运行
失败显示:
System has not been booted with systemd as init system (PID 1). Can't operate.
确认无误时候,安装gnome桌面
sudo apt update
sudo apt install -y ubuntu-desktop
安装 Xrdp 启用rdp远程桌面
sudo apt install -y xrdp
sudo adduser xrdp ssl-cert
sudo systemctl restart xrdp
sudo systemctl enable xrdp
查看一下配置文件中的端口(默认:3389)
vim /etc/xrdp/xrdp.ini
配置防火墙开启3389端口
sudo ufw allow 3389

 

 输入帐号密码

如果有认证点取消

完成










posted @   清风6661  阅读(674)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示