windows 远程桌面 rdp 连接 ubuntu 图形桌面

警告
本文最后更新于 2023-05-07,文中内容可能已过时。

ubuntu 版本可归为两类,桌面版和服务器版。

  • 桌面版(desktop)主要针对个人 pc 使用,带有 GNOME 桌面环境图形化界面,和 windows 类似,可以浏览网页,编辑文档,看视频等,占用系统资源较高,至少需要 4GB 运行内存,磁盘空间至少 20GB。SSH 服务需要手动开启。
  • 服务器版,无头方式 (headless) 运行,无图形化界面,需要通过终端 ssh 远程连接。它主要是为运行网络服务而定制的。默认启用 SSH,占用系统资源少,512MB 运行内存和 5GB 磁盘空间就可以运行。

服务器版也可以安装图形化界面,命令如下:

1
2
sudo apt update
sudo apt install ubuntu-desktop
  1. 开启 SSH 服务
1
2
3
4
5
6
7
8
# 查看是否安装openssh
dpkg -l|grep -i openssh-server
# 如果没有安装
sudo apt install openssh-server
# 确认
systemctl status sshd
sudo apt install net-tools
netstat -luntp|grep -i 22

ubuntu 一般被远程连接是通过 ssh 命令行,也可以通过 vnc,rdp 来连接图形化桌面。windows 远程桌面采用的 rdp 协议,连接效果极佳。

  1. ubuntu 安装 xrdp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#执行系统更新
sudo apt update
#安装xrdp
sudo apt install xrdp

#启动它
sudo systemctl start xrdp
#开机启用
sudo systemctl enable xrdp
#检查状态
sudo systemctl status xrdp
  1. 将 xrdp 用户加入组
1
2
3
4
5
6
7
sudo adduser xrdp ssl-cert 
sudo systemctl restart xrdp

#注意防火墙放行3389端口
sudo ufw allow from any to any port 3389 proto tcp
#查看ubuntu系统ip
ip a
  1. 重启 ubtuntu 系统
  2. window 打开远程桌面 rdp,输入 ubuntu 的 ip 地址连接,session 选择 xorg,账号密码连接。 https://s.imgkb.xyz/abcdocker/2023/05/07/03a6439b04a75/03a6439b04a75.png

Windows 远程 Ubuntu Ubuntu22.04 远程桌面配置(RDP,VNC)

0%