wsl --set-default-version 2
修改Ubuntu20.04下载源
vim /etc/apt/sources.list
在末尾加入
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
sudo apt-get update
sudo apt-get upgrade -y
安装Xfce等依赖(安装图形界面和远程链接)
sudo apt install xorg
sudo apt-get install xfce4
sudo apt-get install xrdp
sudo apt-get install net-tools
sudo apt install -y lightdm
sudo apt install xfce4-goodies
sudo dpkg-reconfigure lightdm
当前用户指定登录session类型
echo "xfce4-session" > ~/.xsession
修改xrdp运行端口,防止与Windows11自带的xrdp服务端口冲突
sudo vim /etc/xrdp/xrdp.ini
修改xrdp的配置文件,把port从3389修改为任意未被占用的端口,避免和本机冲突
sudo echo xfce4-session >~/.xsession
sudo service xrdp restart
配置网络,获取主机的IP
sudo apt install net-tools
ip route | grep default | awk '{print $3}'
install bc bison build-essential ccache curl flex g++-multilib gcc-multilib git git-lfs gnupg gperf imagemagick
lib32readline-dev lib32z1-dev libelf-dev liblz4-tool libncurses5 libncurses5-dev
libssl-dev libxml2 libxml2-utils lzop pngcrush rsync
schedtool squashfs-tools xsltproc
zip zlib1g-dev
开启防火墙端口
sudo ufw allow 33891
打开远程桌面链接
mstsc
使用Windows自带的远程控制进行连接
localhost:33891
注意:每次使用的时候都需要重新输入
wsl --shutdown
wsl -u root
sudo /etc/init.d/xrdp start
或
sudo service xrdp restart
sudo add-apt-repository ppa:maarten-fonville/android-studio
sudo apt install android-studio
sudo apt install openjdk-8-jdk
sudo apt install openjdk-11-jdk
启用systemd
sudo apt install -y ubuntu-desktop xrdp gnome-software gnome-tweaks gnome-shell-extensions
git clone https://github.com/DamionGans/ubuntu-wsl2-systemd-script.git
cd ubuntu-wsl2-systemd-script/
bash ubuntu-wsl2-systemd-script.sh
exec bash
启动XRDP服务
//关闭WSL
wsl --shutdown
wsl -u root
//由于WSL2里面不能用systemd,所以需要手动启动
sudo /etc/init.d/xrdp start
安装中文输入法(需要在WSL Ubuntu20.04 GUI图形界面中操作)
(1).卸载IBus输入法框架
Ubuntu内置了IBus输入法框架,与fcitx冲突,需要事先卸载
sudo apt remove ibus*
(2).安装所需要的软件包
sudo apt install dbus-x11 fcitx im-config fcitx-sunpinyin fcitx-table-wubi
(3).安装后需要重启一次
wsl --shutdown
wsl -u root
sudo /etc/init.d/xrdp start
(4).配置输入法框架
fcitx-config-gtk3
安装搜狗输入法
https://shurufa.sogou.com/
全部0条评论
快来发表一下你的评论吧 !