Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows 通过远程桌面连接 CentOS GUI #97

Closed
Dream4ever opened this issue Oct 6, 2020 · 0 comments
Closed

Windows 通过远程桌面连接 CentOS GUI #97

Dream4ever opened this issue Oct 6, 2020 · 0 comments
Labels
Server The invisible hero Software About installation ande usage

Comments

@Dream4ever
Copy link
Owner

Dream4ever commented Oct 6, 2020

整体流程

完整的流程如下:

CentOS 安装 GNOME Desktop

参考链接:How to install Desktop Environments on CentOS 7?

因为学校服务器在安装 CentOS 时预装了 GUI,所以省去了这一步。

注意:在终端执行 systemctl get-default,如果输出的结果是 graphical.target,说明 CentOS 是启动至 GUI 界面,Windows 可以直接远程桌面连接,无需额外配置。否则还需要执行 sudo systemctl set-default graphical.target,保证 CentOS 启动至 GUI 界面,而不是默认的 Shell。

CentOS 安装 xRDP

在 CentOS 终端依次执行以下命令,来安装并启动 xRDP:

$ yum install epel-release
$ yum install xrdp
$ systemctl enable xrdp
$ systemctl start xrdp
$ systemctl status xrdp # 查看 xRDP 运行状态,确保操作成功

CentOS 开启 3389 端口

在 CentOS 终端依次执行以下命令:

$ firewall-cmd --add-port=3389/tcp
$ firewall-cmd --reload
$ firewall-cmd --list-all # 查看已开放端口,确保操作成功

CentOS 启动 GUI

在 CentOS 终端执行 startx,来启动 GNOME Desktop GUI。

Windows 通过远程桌面连接 CentOS

在 Windows 上打开远程桌面连接,输入 CentOS 的 IP 和用户名,并按照提示输入密码,即可连接到 CentOS 的 GUI。


## CentOS 关闭 3389 端口

每次远程桌面操作完成后,在 CentOS 终端依次执行以下命令,关闭 3389 端口:

```shell
$ firewall-cmd --remove-port=3389/tcp
$ firewall-cmd --reload
$ firewall-cmd --list-all # 查看已开放端口,确保操作成功
@Dream4ever Dream4ever added Software About installation ande usage Server The invisible hero labels Oct 6, 2020
@Dream4ever Dream4ever changed the title Windows 通过远程桌面连接 CentOS Windows 通过远程桌面连接 CentOS GUI Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Server The invisible hero Software About installation ande usage
Projects
None yet
Development

No branches or pull requests

1 participant