1. 安装桌面环境
# 首先安装桌面环境,这里安装 GNOME。
yum -y groups install "GNOME Desktop"
# 从命令行切换到桌面环境
startx
# 获取当前启动模式
systemctl get-default
# 修改启动模式为图形化
systemctl set-default graphical.target
# 修改启动模式为命令行
systemctl set-default multi-user.target
# 默认启动桌面环境后以 root 用户自动登录。
# 修改配置文件:/etc/gdm/custom.conf
# 增加如下配置:
[daemon]
AutomaticLoginEnable=True
AutomaticLogin=root
2. 远程服务设置
# Windows 远程登录需要安装 Xrdp,需要 epel 源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
或:
yum install epel-release
yum install -y xrdp
# Xrdp 会调用 VNC,安装 tigervnc-server
yum install -y tigervnc-server
# 修改 Xrdp 最大连接数
vim /etc/xrdp/xrdp.ini
max_bpp=32
# 启动 Xrdp 并设置开机启动
systemctl start xrdp
systemctl enable xrdp
# 开放 3389 端口
firewall-cmd --permanent --zone=public --add-port=3389/tcp
firewall-cmd --reload
3. 遇到的问题
在 windows 系统里通过远程桌面(mstsc)远程访问 CentOS7 系统的xrdp时出现错误提示:发生身份验证错误,给函数提供的标志无效。
需要修改 /etc/xrdp/xrdp.ini配置文件:
; set SSL protocols
; can be comma separated list of 'SSLv3', 'TLSv1', 'TLSv1.1', 'TLSv1.2', 'TLSv1.3'
ssl_protocols=TLSv1,TLSv1.3
将默认的 TLSV1.3修改为TLSv1,或者用逗号分隔后添加 TLSv1。
之后就可以正常的远程访问桌面,并且相同账号只能有一个画面,方便在不同的地方远程使用。