在wsl2的Ubuntu中使用GUI

    在某视频网站看到在wsl2的ubuntu下安装gui,验证成功后,把过程整理如下.

一、切换国内源

执行命令后

vim /etc/apt/sources.list

清除原来文件内容后,替换以下阿里的源

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

执行更新命令

sudo apt update && sudo apt -y upgrade

二、安装gui相关工具

1、安装xrdp

sudo apt-get install xrdp

2、安装xfce4

sudo apt -y install xfce4

选择gdm3

3、备份文件

sudo cp /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.bak

4、修改 xrdp.ini 文件

sudo sed -i 's/3389/3390/g' /etc/xrdp/xrdp.ini
sudo sed -i 's/max_bpp=32/#max_bpp=32\nmax_bpp=128/g' /etc/xrdp/xrdp.ini
sudo sed -i 's/xserverbpp=24/#xserverbpp=24\nxserverbpp=128/g' /etc/xrdp/xrdp.ini

5、修改startwm.sh

vim /etc/xrdp/startwm.sh

注释掉最后两行后,添加

startxfce4

6、启动gui

sudo /etc/init.d/xrdp start

三、登陆界面

通过window的RDP 输入

localhost:3390

在wsl2的Ubuntu中使用GUI_第1张图片

四、运行结果

在wsl2的Ubuntu中使用GUI_第2张图片

在wsl2的Ubuntu中使用GUI_第3张图片

 

在wsl2的Ubuntu中使用GUI_第4张图片

你可能感兴趣的:(分享)