[Exchange and share] wsl2安装deepinV23 preview
Tofloor
poster avatar
川顺页
deepin
2022-08-05 04:21
Author

准备工作

  • win10/win11系统
  • 已安装wsl
  • 已安装VM 16 pro
  • 已下载DeepinV23 preview iso镜像包。

正式开始

  1. 启动VM虚拟机,一路安装iso镜像,创建好用户名,进入桌面,然后打开虚拟机终端,获取ip
  2. 注销系统,但不关闭。
  3. 在windows用终端或者xshell,利用ssh连接虚拟机。
  4. 开始压缩整个系统
sudo tar -cpvf /deepin_v23.tar \
--exclude=/deepin_v23.tar \
--exclude=/proc \
--exclude=/tmp \
--exclude=/lost+found \
--exclude=/media \
--exclude=/mnt \
--one-file-system /

6 . 将压缩文件移动到虚拟机一个新目录,比如复制到当前用户的根目录下的temp目录

mkdir temp
sudo mv /deepin_v23.tar ~/temp
cd ~/temp
  1. 新建相关目录(使用root权限),然后将新目录追加到压缩文件
sudo mkdir proc tmp lost+found media mnt run
# 改一下相关权限
sudo chmod -w proc
sudo chmod 777 -R tmp
sudo chmod 700 -R lost+found

# 追加文件
sudo tar -rvf deepin_v23.tar proc
sudo tar -rvf deepin_v23.tar tmp
sudo tar -rvf deepin_v23.tar lost+found
sudo tar -rvf deepin_v23.tar media
sudo tar -rvf deepin_v23.tar mnt
  1. 将tar从虚拟机复制到windows主机l(注意目录,建议和我一样,提前创建好相关文件夹 D:\wsl\DeepinV23)
scp userxxx@xxx.xxx.xxx.xxx:/home/xxx/temp/deepin_v23.tar D:\wsl\DeepinV23\
  1. 导入tar到wsl(注意目录,建议和我一样,提前创建好相关文件夹 D:\wsl\DeepinV23)
wsl  --import DeepinV23  D:\wsl\DeepinV23 D:\wsl\DeepinV23\deepin_v23.tar --version 2
  1. 运行wsl
wsl -d DeepinV23

其它设置

  • 修改磁盘挂载
vim /etc/fstab

# 注释原有的,修改为下面的内容
LABEL=cloudimg-rootfs /  ext4 discard,errors=remount-ro 0 1
# 或者直接一键修改
echo "LABEL=cloudimg-rootfs /  ext4 discard,errors=remount-ro 0 1" > /etc/fstab

# 然后关闭并重新打开
wsl --terminate DeepinV23
wsl -d DeepinV23
  • 新增用户,并给与sudo权限(可以省略,非必须)
# 新建一个用户,一路回车即可
sudo adduser tlntin

# 将新用户加入到sudo组
sudo usermod -aG sudo tlntin

# 修改sudo文件
chmod +w /etc/sudoers
vim /etc/sudoers
# 在 root    ALL=(ALL:ALL) ALL新增一行你的用户名
# 改完后如下:
root    ALL=(ALL:ALL) ALL
tlntin  ALL=(ALL:ALL) ALL
# 重新改回权限
chmod -w /etc/sudoers
  • 经测试sudo密码总是出错(可能是Bug),所以直接改成sudo用户组下面所有sudo命令免密码使用
chmod +w /etc/sudoers
vim /etc/sudoers
# 将
%sudo   ALL=(ALL:ALL) ALL
# 改成
%sudo   ALL=(ALL:ALL) NOPASSWD:ALL
chmod -w /etc/sudoers

  • 提示 upgradable.go:221: stat /etc/apt/sources.list.d/security.list: no such file or directory
# 直接touch新建一个假的忽悠他即可解决(也可以先暂时忽略,先弄systemd服务)
sudo touch /etc/apt/sources.list.d/security.list
  • 提示 E: lstat /lastore/override/desktop2uaid: no such file or directory
# 同样新建对应文件即可(也可以先暂时忽略,先弄systemd服务)
sudo mkdir -p /lastore/override/
sudo touch /lastore/override/desktop2uaid
  • 提示 backend_syslog.go:45: syslog is not available: Unix syslog delivery error
  • 开启systemd服务后解决了。
  • 改tmp权限(如果之前改过了应该可以不用改了)
sudo chmod -R 777 /tmp
  • 修改默认普通用户启动
- 方法1:关闭并重新打开windows_termial
- 将其中的deepin_v23配置,启动命令后面加一个-u 你的用户名,例如下面这样。
C:\Windows\system32\wsl.exe -d DeepinV23 -u tlntin

- 方法二:打开powershell(推荐)
- 输入下面的命令新建一个函数
Function WSL-SetDefaultUser ($distro, $user) { Get-ItemProperty Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\*\ DistributionName | Where-Object -Property DistributionName -eq $distro | Set-ItemProperty -Name DefaultUid -Value ((wsl -d $distro -u $user -e id -u) | Out-String); };
- 设置默认打开用户名(用户名改成你的)
WSL-SetDefaultUser DeepinV23 tlntin

a244c0a8223355fd6014e20717b26032.png

  • 启用systemd服务(不启用则ll-cli无法联网),参考连接
curl -L -O "https://raw.githubusercontent.com/nullpo-head/wsl-distrod/main/install.sh"
chmod +x install.sh
sudo ./install.sh install
sudo /opt/distrod/bin/distrod enable
  • 启动networking服务(可选)
sudo systemctl start networking.service
sudo systemctl enable networking.service
  • 测试玲珑包服务
tlntin@MacMini:~$ ll-cli query wps
appId                           name                            version         arch        channel         module      description
cn.wps.wps-office               wps-office                      11.1.0.10161    x86_64      linglong        runtime     WPS Office 2019 for Linux 办公软件,是一款兼容、开放、高效、安全并极具中文本土化...
cn.wps.wps-office               wps-office                      11.1.0.10920    x86_64      linglong        runtime     WPS Office 2019 for Linux 办公软件,是一款兼容、开放、高效、安全并极具中文本土化...
cn.wps.wps-office               wps-office                      11.1.0.10919    x86_64      linglong        runtime     WPS Office 2019 for Linux 办公软件,是一款兼容、开放、高效、安全并极具中文本土化...
  • 测试neofetch
    d11f5d74710b5b52517931305d7b947e.png
  • 测试deepin终端(wsl输入 deepin-terminal)
    00138d9d210a8a65f7ffa13bed6d3b0d.png
  • deepin文件管理器(wsl输入 dde-file-manager)
    c57feced1a62b55391420f72cf7f0c29.png
  • deepin系统监视管理器(wsl输入 deepin-system-monitor)
    01a882f9afe1aa74deae07d7016a9a11.png
  • 安装英伟达驱动,然后去下载cuda(可选)/cudnn(可选),测试了一下paddle与pytorch炼丹均正常。
sudo apt install nvidia-driver
  • 打开控制中心(Deepin-Control-Center)
    d165d5e6292a2929fb4aacaf1a300900.png
    2369a50f4a9b27796cb5346407581561.png

删除wsl镜像

wsl --list
wsl --unregister DeepinV23
Reply Favorite View the author
All Replies
xuqi
deepin testing team
2022-08-05 05:09
#1

kissing_heart👍

赞一个~

Reply View the author
PossibleVing
deepin
2022-08-05 05:20
#2

proud

Mark 一下,收藏了~

我记得之前 GitHub 有个 “Deepin-WSL” 项目,但好像没动静了,这个教程可以很好解决这方面需求~👍

Reply View the author
fallingstar-ten
deepin
2022-08-05 17:14
#3

求分享包

Reply View the author
川顺页
deepin
2022-08-05 17:31
#4
fallingstar-ten

求分享包

😂 1.压缩后的tar有7个多g,还不如你自己弄一下。

  1. 系统这种东西不太适合分享,万一遇到啥病毒了,肯定分享人要背锅的。自己拿官方iso镜像做,更加放心。
Reply View the author
fallingstar-ten
deepin
2022-08-05 19:18
#5
川顺页

😂 1.压缩后的tar有7个多g,还不如你自己弄一下。

  1. 系统这种东西不太适合分享,万一遇到啥病毒了,肯定分享人要背锅的。自己拿官方iso镜像做,更加放心。

好家伙 没想到这么大 我还以为是3-4g

Reply View the author
川顺页
deepin
2022-08-05 19:28
#6
fallingstar-ten

好家伙 没想到这么大 我还以为是3-4g

压缩格式问题,如果是tz或者xz会小很多。但是不确定wsl能支持其它压缩格式,所以只能保持tar格式了。

而且tar格式可以添加其它文件实现再压缩,比较适合wsl一键导入。

试了一下tar.xz格式

  • 用xz将tar压缩成tar.xz(注:-9为最高级压缩,默认为-6,-T 12为12核/线程,-k保留原文件,-z开启压缩。)
xz -9 -T 12 -k -z deepin_v23.tar
  • 压缩后结果(7G变成1.8G)
    1d42e75363b2e45457568e3709a33023.png
  • 解压tar.xz到tar(注:-9为最高级压缩,默认为-6,-T 12为12核/线程,-k保留原文件,-d开启解压。)
xz -9 -T 12 -k -d deepin_v23.tar.xz
  • 文件链接:https://www.123pan.com/s/oEqDVv-HVck提取码:ibwN
Reply View the author
babyfengfjx
Super Moderator
CQA
2022-08-05 22:10
#7

秀儿啊!

这么牛皮的分享!

Reply View the author
真◆伟平無双
deepin
2022-08-06 18:23
#8

不用xserver就能打开gui界面了吗?没看到在宿主机装xserver啊,是因为win11支持了吗

Reply View the author
川顺页
deepin
2022-08-07 00:07
#9
真◆伟平無双

不用xserver就能打开gui界面了吗?没看到在宿主机装xserver啊,是因为win11支持了吗

wsl 2默认可以

Reply View the author
Joyed
deepin
2022-08-24 08:32
#10

你好,可以看下这两个问题吗,按照教程一步一步来的,然后玲珑包的服务不可用,并且图形窗口打不开。

# ll-cli query wps
start ll-service failed
app not found in repo
# ll-service
service exist QDBusError("org.freedesktop.DBus.Error.Disconnected", "Not connected to D-Bus server")
# deepin-terminal
qt.qpa.xcb: could not connect to display :0
QStandardPaths: runtime directory '/mnt/wslg/runtime-dir' is not owned by UID 1001, but a directory permissions 0700 owned by UID 1000 GID 100
Segmentation fault
Reply View the author
泠恒谦
deepin
2022-08-25 21:20
#11
  • 只是有点迷惑,为什么 Deepin 不把 Preview 的镜像注册入 Microsoft Store 以方便直接在 WSL 安装?又不是没有实体公司来完成注册流程,这样导入实际很麻烦。
  • 与 Microsoft Store 发行版注册相关的问题应该艾特哪位官方人员?
Reply View the author
泠恒谦
deepin
2022-08-26 02:18
#12
泠恒谦
  • 只是有点迷惑,为什么 Deepin 不把 Preview 的镜像注册入 Microsoft Store 以方便直接在 WSL 安装?又不是没有实体公司来完成注册流程,这样导入实际很麻烦。
  • 与 Microsoft Store 发行版注册相关的问题应该艾特哪位官方人员?
Reply View the author
寂静的羽夏
deepin
2022-08-26 02:24
#13
泠恒谦

这个我就不清楚了,我在用 Deepin 之前研究 win 研究的多一些。我没记错的话上架到微软商店是需要钱的,具体多少我忘了,是一次性的还是像苹果订阅收费我记不清了。

有关上架问题我建议在微软社区直接咨询更好一些。

Reply View the author
川顺页
deepin
2022-08-26 06:38
#14
Joyed

你好,可以看下这两个问题吗,按照教程一步一步来的,然后玲珑包的服务不可用,并且图形窗口打不开。

# ll-cli query wps
start ll-service failed
app not found in repo
# ll-service
service exist QDBusError("org.freedesktop.DBus.Error.Disconnected", "Not connected to D-Bus server")
# deepin-terminal
qt.qpa.xcb: could not connect to display :0
QStandardPaths: runtime directory '/mnt/wslg/runtime-dir' is not owned by UID 1001, but a directory permissions 0700 owned by UID 1000 GID 100
Segmentation fault

需要开启systemd服务。

第二个问题,大概率是你没有用wsl2,升级一下wsl,然后转化成wsl2就行了。

Reply View the author
泠恒谦
deepin
2022-08-26 20:08
#15
寂静的羽夏

这个我就不清楚了,我在用 Deepin 之前研究 win 研究的多一些。我没记错的话上架到微软商店是需要钱的,具体多少我忘了,是一次性的还是像苹果订阅收费我记不清了。

有关上架问题我建议在微软社区直接咨询更好一些。

面向 Linux 发行版维护人员
若要提交到 Store,你需要与我们合作以获得发布批准。 如果你是有兴趣将发行版添加到 Microsoft Store 的 Linux 发行版所有者,请联系 wslpartners@microsoft.com。
  • 这就是我上面迷惑应该艾特哪位官方人员的原因。因为普通用户不可能有这个许可。
Reply View the author
Joyed
deepin
2022-08-30 04:52
#16
川顺页

需要开启systemd服务。

第二个问题,大概率是你没有用wsl2,升级一下wsl,然后转化成wsl2就行了。

systemd开着呢,还是不行,不知道什么原因,暂时不管了

第二个问题原因找到了

  1. wslg的文件夹的拥有者是虚拟机中创建的用户,使用该用户登录才可以,改了拥有者每次重启又会改回去,不知道具体什么机制(PS:我试了下在虚拟机中创建的用户sudo可以正常使用)
  2. 然后需要启动D-Bus,并且把qpa设置为wayland,下面两条命令加入到profile中
eval `dbus-launch --auto-syntax`
export QT_QPA_PLATFORM='wayland'

Reply View the author
whoam1
deepin
2022-11-18 23:50
#17
PossibleVing

proud

Mark 一下,收藏了~

我记得之前 GitHub 有个 “Deepin-WSL” 项目,但好像没动静了,这个教程可以很好解决这方面需求~👍

那个系统可以一直更新的,我就在用

Reply View the author