WSL2+Ubuntu20.04桌面功能配置
能使用系統自帶的遠程桌面就使用這個,子系統是重裝后干凈的系統
使用清華的軟件源mirrors.tuna.tsinghua.edu.cn
,備份軟件源?不存在的
# sudo vi /etc/apt/sources.list use `:%d` command empty file contents
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
添加完還是要記得apt update;apt upgrade
更新並且升級下包
其次就是WSL自帶的SSH有點的問題,要remove並重新install,然后修改配置文件中的端口並重啟ssh服務 ,
因為默認的是22端口,但是windows的ssh服務默認也是22端口(如果不用Windows Terminal的話)。
sudo apt autoremove --purge openssh-server -y && sudo apt install openssh-server -y
sudo service ssh --full-restart
虛擬套件:ubuntu-desktop 2000MB+!!
解決WSL2不支持 systemd
git clone https://github.com/DamionGans/ubuntu-wsl2-systemd-script.git
cd ubuntu-wsl2-systemd-script/
bash ubuntu-wsl2-systemd-script.sh
- 重啟子系統
安裝桌面環境
sudo apt install ubuntu-desktop && sudo apt install -y xrdp
安裝桌面套件和xrdp服務systemctl status xrdp
查看是否正常運行起來sudo adduser xrdp ssl-cert && sudo systemctl restart xrdp
重啟xrdp並開放sudo ufw allow 3389
開啟默認的3389端口- 然后使用自帶的遠程桌面軟件,ip填寫
localshot:3389
就ok - 每次開機都需要
sudo systemctl start xrdp
總結
用起來好卡。。不爽的很
參考
- wsl2 ubuntu Gnome 桌面 https://www.cnblogs.com/zbseoag/p/13851439.html 【最有用!】
- 使用xshell登錄ubuntu on windows(wsl) https://www.jianshu.com/p/039411d2c1f6
- Linux 之 .bashrc 文件作用 https://www.cnblogs.com/midworld/p/11006967.html
- 安裝Ubuntu子系統 – 以及安裝帶有Unity的圖形化界面 https://www.daniao.org/5258.html