安装WSL-Ubuntu 到其他分区
#启用WSL Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux #创建目录 New-Item D:WSL -ItemType Directory Set-Location D:WSL #下载安装程序,这个过程比较慢,要多等一段时间 Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile Ubuntu.appx -UseBasicParsing Rename-Item .Ubuntu.appx Ubuntu.zip Expand-Archive .Ubuntu.zip -Verbose #运行程序 cd Ubuntu .ubuntu1804.exe
重装
1.把整个目录删除 2.再执行 wslconfig /u Ubuntu 3.重装
切换镜像(vi /etc/apt/sources.list,最前面加入下面信息)
cp /etc/apt/sources.list /etc/apt/sources.list.bak
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
查看系统版本
lsb_release -a
更新仓库
1 sudo apt update 2 sudo apt upgrade 3 sudo apt autoremove
安装桌面环境xubuntu
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
安装远程桌面服务xrdp
sudo apt install xrdp
配置xrdp端口(这里面3389是默认配置,这里将其改为3390是避免和windows的端口冲突。)
sudo sed -i 's/port=3389/port=3390/g' /etc/xrdp/xrdp.ini
配置xsession
sudo echo xfce4-session >~/.xsession
重启Ubuntu
#cmd (管理员) #停止 net stop LxssManager #启动 net start LxssManager #批处理 (管理员) #停止 start cmd /k net stop LxssManager #启动 start cmd /k net start LxssManager
启动xrdp
sudo service xrdp restart
远程连接
在windows开始菜单中搜远程桌面(Remote)打开后在计算机后面输入localhost:3390点击连接。首次连接可能需要较长时间。
汉化
sudo dpkg-reconfigure locales