WSL2+Ubuntu20.04桌面功能配置


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

  1. git clone https://github.com/DamionGans/ubuntu-wsl2-systemd-script.git
  2. cd ubuntu-wsl2-systemd-script/
  3. bash ubuntu-wsl2-systemd-script.sh
  4. 重啟子系統

安裝桌面環境

  1. sudo apt install ubuntu-desktop && sudo apt install -y xrdp 安裝桌面套件和xrdp服務
  2. systemctl status xrdp查看是否正常運行起來
  3. sudo adduser xrdp ssl-cert && sudo systemctl restart xrdp 重啟xrdp並開放
  4. sudo ufw allow 3389 開啟默認的3389端口
  5. 然后使用自帶的遠程桌面軟件,ip填寫localshot:3389 就ok
  6. 每次開機都需要sudo systemctl start xrdp

總結

用起來好卡。。不爽的很

參考

  1. wsl2 ubuntu Gnome 桌面 https://www.cnblogs.com/zbseoag/p/13851439.html 【最有用!】
  2. 使用xshell登錄ubuntu on windows(wsl) https://www.jianshu.com/p/039411d2c1f6
  3. Linux 之 .bashrc 文件作用 https://www.cnblogs.com/midworld/p/11006967.html
  4. 安裝Ubuntu子系統 – 以及安裝帶有Unity的圖形化界面 https://www.daniao.org/5258.html


免責聲明!

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



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