BlueRoseNote/07-Other/Qt/使用WSL安装Ubantu来测试Qt.md

58 lines
2.1 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 前言
参考:
- 2023最新WSL搭建深度学习平台教程:https://zhuanlan.zhihu.com/p/621142457
- WSL2 + Ubuntu + 图形界面安装:https://www.bilibili.com/read/cv11143517/
- https://zhuanlan.zhihu.com/p/150555651
# 安装
更新wsl 1=>2
https://learn.microsoft.com/zh-cn/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package
文件下载地址https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
- wsl --set-default-version 2
## 安装Ubuntu
- 在Micrsoft Store中搜索Ubantu22.04并且安装
- 之后运行Ubuntu22.04会报错报错WslRegisterDistribution failed with error: 0x8007019e
- 以管理员模式运行PowerShell并且运行Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
- 重启后运行Ubuntu22.04即可安装
## 桌面安装
https://blog.csdn.net/weixin_44478077/article/details/128723158
1. sudo apt-get intall xrdp
2. sudo apt-get intall xubuntu-desktop
3. sudo apt-get install ubuntu-desktop
4. sudo service dbus restart
5. 执行`sudo vi ~/.bashrc`编辑用户设置vi按i插入
```
export DISPLAY=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):0.0
export XDG_SESSION_TYPE=x11
```
保存后执行`source ~/.bashrc`生效。
6. 保证VcXsrv启动状态下输入gnome-session
```bash
echo xfce4-session >~/.xsession
sudo service xrdp restart
Restarting Remote Desktop Protocol server
[20190719-15:20:51] [DEBUG] Testing if xrdp can listen on 0.0.0.0 port 3390.
[20190719-15:20:51] [DEBUG] Closed socket 6 (AF_INET6 :: port 3390)
```
# 进入wsl
# Hyper-V
## 设置分辨率
1.  **sudo vi /etc/default/grub** 找到GRUB_CMDLINE_LINUX_DEFAULT配置, 添加 video=hyperv_fb:[你自己的分辨率值]’。 比如我的是1920x1080. 所以改完后的结果为:GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1920x1080"
2. 保存并退出vi.
3. 运行:**sudo update-grub**
4. 重启虚拟机:**sudo reboot**
# 安装Qt
# 问题解决
- WslRegisterDistribution failed with error: 0x8037010d
- 管理员模式运行PowerShell执行dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart