sudo apt update && sudo apt upgrade -y # 安裝輕量桌面 XFCE sudo apt install -y xfce4 xfce4-goodies # 安裝 xrdp 與必要套件 sudo apt install -y xrdp dbus-x11
sudo systemctl disable lightdm sudo systemctl stop lightdm
sudo sed -i 's/#WaylandEnable=false/WaylandEnable=false/' /etc/gdm3/custom.conf執行就會出現
$ sudo sed -i 's/#WaylandEnable=false/WaylandEnable=false/' /etc/gdm3/custom.conf sed: can't read /etc/gdm3/custom.conf: No such file or directory
echo xfce4-session > ~/.xsession chmod +x ~/.xsession
# 先備份 sudo cp /etc/xrdp/startwm.sh /etc/xrdp/startwm.sh.bak # 寫入新內容 sudo bash -c 'cat > /etc/xrdp/startwm.sh << EOF #!/bin/sh export XDG_SESSION_TYPE=x11 export XDG_SESSION_DESKTOP=xfce export XDG_CURRENT_DESKTOP=XFCE unset DBUS_SESSION_BUS_ADDRESS unset XDG_RUNTIME_DIR if test -r /etc/profile; then . /etc/profile fi if test -r ~/.profile; then . ~/.profile fi exec startxfce4 EOF' sudo chmod +x /etc/xrdp/startwm.sh
sudo mkdir -p /etc/polkit-1/localauthority/50-local.d/ sudo bash -c 'cat > /etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla << EOF [Allow Colord all Users] Identity=unix-user:* Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile ResultAny=yes ResultInactive=yes ResultActive=yes EOF'
sudo adduser xrdp ssl-certsudo systemctl enable xrdp sudo systemctl enable xrdp-sesman
sudo systemctl restart xrdpsudo systemctl status xrdpsudo ufw allow 3389/tcp sudo ufw reload sudo ufw status
# 重開機後確認 xrdp 是否自動啟動 sudo reboot # 重開機後 SSH 進去確認 sudo systemctl is-enabled xrdp # 應顯示 "enabled" sudo systemctl is-active xrdp # 應顯示 "active" # 確認 LightDM 已停用 sudo systemctl is-enabled lightdm # 應顯示 disabled # 確認 port 3389 正在監聽 sudo ss -tlnp | grep 3389
# 安裝 IBus 與注音輸入法(新酷音 chewing) sudo apt install -y ibus ibus-chewing # 設定 IBus 為預設輸入法框架 im-config -n ibus # 將 IBus 加入啟動環境 echo 'export GTK_IM_MODULE=ibus export XMODIFIERS=@im=ibus export QT_IM_MODULE=ibus ibus-daemon -drx' >> ~/.profile 然後啟動 IBus 設定: ibus-daemon -drx & ibus-setup 在 IBus 設定視窗中: 點 Input Method 分頁 點 Add → 搜尋 Chinese → 選 Chewing(新酷音) 確認後關閉
可以重新啟動 ibus 後, 再次進入 ibus-setup
ibus restart ibus-setup