安装WSL-Ubuntu 到其他分区
因为要装好多东西,C盘太小了!
1 #启用WSL 2 Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux 3 4 #创建目录 5 New-Item D:\WSL -ItemType Directory 6 Set-Location D:\WSL 7 8 #下载安装程序,这个过程比较慢,要多等一段时间 9 Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile Ubuntu.appx -UseBasicParsing 10 Rename-Item .\Ubuntu.appx Ubuntu.zip 11 Expand-Archive .\Ubuntu.zip -Verbose 12 13 #运行程序 14 cd Ubuntu 15 .\ubuntu1804.exe 16 ———————————————— 17 版权声明:本文为CSDN博主「fleaxin」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 18 原文链接:https://blog.csdn.net/fleaxin/article/details/88587081
重装
1 当系统需要重装的话,把整个目录删除,重新按照前面的步骤安装即可。运行程序"ubuntu.exe"后,有可能出错0x80070040,只要再执行 2 wslconfig /u Ubuntu 3 重新尝试即可。
安装XUbuntu-Desktop
1 cp /etc/apt/sources.list /etc/apt/sources.list.bak
然后执行vi /etc/apt/sources.list
并在文件最开始添加如下信息:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse ———————————————— 版权声明:本文为CSDN博主「-_-void」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/xmh19936688/article/details/90212960
查看系统版本信息:
1 lsb_release -a
更新仓库
1 sudo apt update 2 sudo apt upgrade 3 sudo apt autoremove
安装桌面环境xubuntu
1 sudo apt install xubuntu-desktop
安装远程桌面服务xrdp
1 sudo apt install xrdp
配置xrdp端口
1 sudo sed -i 's/port=3389/port=3390/g' /etc/xrdp/xrdp.ini
这里面3389是默认配置,这里将其改为3390是避免和windows的端口冲突。我们折腾的是子系统不是虚拟机,两边的端口号是通的。比如在wsl中开一个8080端口的WebServer,在windows中开浏览器是可以直接访问的。(原作者写 https://blog.csdn.net/xmh19936688/article/details/90212960)
配置xsession
1 sudo echo xfce4-session >~/.xsession
启动xrdp
1 sudo service xrdp restart
远程连接
在windows开始菜单中搜
远程桌面
打开后在计算机
后面输入localhost:3390
点击连接。首次连接可能需要较长时间。
用户名密码可以先写,也可以不写,网上有教程还勾选了保存凭据的,这个看个人习惯吧,我用软件从来不勾选记住密码的。
汉化
1 sudo dpkg-reconfigure locales