RedHat8 远程桌面连接设置
RedHat8
默认情况下用 XManager
无法远程连接,通过安装配置 lightdm
才可以远程连接,但是界面效果不佳,这里不推荐。
RedHat设置远程桌面控制
通过一组简单的远程连接命令,只需要在Linux
(redhat
)上装一个tigervnc-server
,然后启动服务,之后就可以远程连接桌面了,操作步骤将在下面详细介绍:
安装相关软件
《1》安装epel库
首先远程连接命令,需要安装epel
库,这个直接在终端输入命令“yum install -y epel-release”
就行,如下:
[root@redhat8 ~]#
[root@redhat8 ~]# yum install -y epel-release
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Repository base is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
Last metadata expiration check: 0:04:29 ago on Sun 06 Aug 2023 09:56:54 AM CST.
Package epel-release-8-11.el8.noarch is already installed.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Upgrading:
epel-release noarch 8-19.el8 epel 25 k
Transaction Summary
================================================================================
Upgrade 1 Package
Total download size: 25 k
《2》安装xrdp服务
接着就是安装xrdp
远程连接命令,xrdp
在启动服务的过程中,会自动开启VNC
服务,安装的话,直接运行命令“yum install -y xrdp”
就行,如下:
[root@redhat8 ~]#
[root@redhat8 ~]# yum install -y xrdp
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Repository base is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
Last metadata expiration check: 0:04:45 ago on Sun 06 Aug 2023 09:56:54 AM CST.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
xrdp x86_64 1:0.9.22.1-2.el8 epel 475 k
Installing dependencies:
imlib2 x86_64 1.4.9-8.el8 epel 222 k
Transaction Summary
================================================================================
Install 2 Packages
《3》安装tigervnc-server服务
然后就是安装tigervnc-server
远程连接命令,这个也直接输入安装命令“yum install -y tigervnc-server”
就行,如下:
[root@redhat8 ~]#
[root@redhat8 ~]# yum install -y tigervnc-server
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Repository base is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
Last metadata expiration check: 0:05:11 ago on Sun 06 Aug 2023 09:56:54 AM CST.
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
tigervnc-server x86_64 1.11.0-9.el8 AppStream 270 k
Upgrading:
selinux-policy noarch 3.14.3-80.el8_5.2 base 636 k
selinux-policy-targeted noarch 3.14.3-80.el8_5.2 base 15 M
tigervnc-server-minimal x86_64 1.11.0-9.el8 AppStream 1.1 M
Installing dependencies:
tigervnc-selinux noarch 1.11.0-9.el8 AppStream 47 k
Transaction Summary
================================================================================
Install 2 Packages
Upgrade 3 Packages
设置远程登陆账号密码
《1》root 账户
设置 root
用户的 VNC
password
远程连接命令,运行 "vncpasswd root"
命令,自行设置就可以,如下:
[root@redhat8 ~]#
[root@redhat8 ~]# vncpasswd root
Password:
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
[root@redhat8 ~]#
设置防火墙
《1》关闭防火墙
接着需要关闭防火墙(命令"systemctl stop firewalld"
),关闭防火墙开机自启动(命令"systemctl disable firewalld"
)。
[root@redhat8 ~]# systemctl stop firewalld
[root@redhat8 ~]# systemctl disable firewalld
《2》关闭SELinux
修改selinux
为disabled
状态,文件目录/etc/selinux/config
,如下:
启动远程桌面服务
启动xrdp
服务远程连接命令,运行命令"systemctl start xrdp"
,检查服务状态,如下所示:
[root@redhat8 ~]#
[root@redhat8 ~]# systemctl start xrdp
[root@redhat8 ~]# systemctl status xrdp
● xrdp.service - xrdp daemon
Loaded: loaded (/usr/lib/systemd/system/xrdp.service; disabled; vendor preset: disabled)
Active: active (running) since Sun 2023-08-06 10:04:28 CST; 38min ago
Docs: man:xrdp(8)
man:xrdp.ini(5)
Main PID: 44373 (xrdp)
Tasks: 1 (limit: 32905)
Memory: 2.6M
CGroup: /system.slice/xrdp.service
└─44373 /usr/sbin/xrdp --nodaemon
Aug 06 10:32:03 redhat8 xrdp[46289]: [INFO ] VNC receiving name
Windows 远程桌面连接
打开 Windows
远程桌面连接,输入 Linux
主机ip
地址:
接着在登录页面输入root
和root123
远程连接命令,如下,点击OK
按钮:
成功连接Linux
桌面后的效果如下远程连接命令,使用起来还是非常不错的:
输入 root
用户密码,登陆到 Linux
系统中: