安装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 重新尝试即可。
更新
列出发行版
wslconfig /l
删除发行版
wslconfig /u 发行版名称
安装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
可能会出现错误
1 dpkg: error processing package blueman (--configure): 2 installed blueman package post-installation script subprocess returned error exit status 1 3 Errors were encountered while processing: 4 blueman 5 E: Sub-process /usr/bin/dpkg returned an error code (1)
解决方法如下:
1 $ sudo mv /var/lib/dpkg/info/ /var/lib/dpkg/info_old/ 2 $ sudo mkdir /var/lib/dpkg/info/ 3 $ sudo apt-get update 4 ... 5 $ sudo apt-get -f install 6 Reading package lists... Done 7 Building dependency tree 8 Reading state information... Done 9 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 10 7 not fully installed or removed. 11 After this operation, 0 B of additional disk space will be used. 12 Setting up bluez (4.101-0ubuntu13.1) ... 13 Setting up blueman (1.23-git201403102151-1ubuntu1) ... 14 Setting up bluetooth (4.101-0ubuntu13.1) ... 15 Setting up bluez-alsa:amd64 (4.101-0ubuntu13.1) ... 16 Setting up bluez-alsa:i386 (4.101-0ubuntu13.1) ... 17 Setting up bluez-gstreamer (4.101-0ubuntu13.1) ... 18 Setting up bluez-utils (4.101-0ubuntu13.1) ... 19 $ sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info_old/ 20 $ sudo rm -rf /var/lib/dpkg/info 21 22 ———————————————— 23 版权声明:本文为CSDN博主「wxysunshy」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 24 原文链接:https://blog.csdn.net/sun___shy/article/details/80917134
安装远程桌面服务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
重启Ubuntu
1 #cmd (管理员) 2 #停止 3 net stop LxssManager 4 5 #启动 6 net start LxssManager 7 8 #批处理 (管理员) 9 #停止 10 start cmd /k net stop LxssManager 11 12 #启动 13 start cmd /k net start LxssManager
启动xrdp
1 sudo service xrdp restart
远程连接
在windows开始菜单中搜
远程桌面
打开后在计算机
后面输入localhost:3390
点击连接。首次连接可能需要较长时间。
用户名密码可以先写,也可以不写,网上有教程还勾选了保存凭据的,这个看个人习惯吧,我用软件从来不勾选记住密码的。
汉化
1 sudo dpkg-reconfigure locales
就是连不上vnc,,,
最后折腾到这里就OK了