WSL-Ubuntu 安裝(其他分區)


安裝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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM