windows wsl ubuntu系统安装桌面可视化

参考:

https://www.bilibili.com/read/cv33557374/

1)首先先安装好wsl ubuntu系统

2)安装 Ubuntu 桌面版

bash 复制代码
sudo apt purge -y acpid acpi-support modemmanager

sudo apt-mark hold acpid acpi-support modemmanager 

sudo apt install ubuntu-desktop 

3)配置显示管理器

安装 Xfce4 桌面环境:

bash 复制代码
sudo apt install xfce4 xfce4-goodies 

在 Ubuntu 终端中设置 DISPLAY 环境变量:

bash 复制代码
export DISPLAY=$(awk '/nameserver / {print$2; exit}' /etc/resolv.conf 2>/dev/null):0 

使用sudo 启动 Xfce 会话:

bash 复制代码
sudo startxfce4 

启动报错sudo startxfce4

/usr/bin/startxfce4: X server already running on display 127.0.0.42:0

xrdb: Connection refused

xrdb: Can't open display '127.0.0.42:0'

xfce4-session: Cannot open display: .

Type 'xfce4-session --help' for usage.sudo startxfce4

/usr/bin/startxfce4: X server already running on display 127.0.0.42:0

xrdb: Connection refused

xrdb: Can't open display '127.0.0.42:0'

xfce4-session: Cannot open display: .

Type 'xfce4-session --help' for usage.

修改:

如果输出为空或不正确,你可以手动设置 DISPLAY 变量:

bash 复制代码
export DISPLAY=:0

4)修改后重新启动

bash 复制代码
sudo startxfce4

桌面可以看到,但是背景是透明的

相关推荐
weixin_307779133 小时前
Linux下Nginx故障系统化检查Shell脚本
linux·运维·服务器·nginx·自动化
skyutuzz4 小时前
node安装部署
linux
一次旅行4 小时前
【AI工具】Rust-Based CLI:用 xargs 和并行加速你的 Linux 日常
linux·开发语言·rust
印度神油96 小时前
Windows Python 打包实战:Nuitka 环境踩坑总结与 CI 自动化构建全指南
windows·python·ci/cd
2601_963771376 小时前
Hardening Enterprise WordPress Sites Against REST API Leaks and Bad Headers
前端·windows·word·php
qetfw7 小时前
CentOS 7 基础环境配置
linux·运维·centos
天空'之城7 小时前
Linux 系统编程 21:守护进程与日志系统全解
linux·系统编程·日志系统·守护进程
l1t8 小时前
用split命令恢复被wget -c命令误追加的zip压缩包
linux
辉灰笔记9 小时前
MySQL8 意外关机/误移data目录导致服务启动失败 PID报错/权限报错 修复文档
linux·数据库·mysql·centos
不要小看我们之间的羁绊啊9 小时前
【windows】cc + cc switch + headroom
windows