1、安装GUI

yum groupinstall "Server with GUI"


2、安装VNC

yum install tigervnc-server -y


3、禁用安全设置

/sbin/setenforce 0
sed -i 's\SELINUX=enforcing\SELINUX=disabled\' /etc/selinux/config
systemctl stop firewalld.service 
systemctl disable firewalld.service


4、设置登陆用户

cat /etc/tigervnc/vncserver.users 
# TigerVNC User assignment
#
# This file assigns users to specific VNC display numbers.
# The syntax is <display>=<username>. E.g.:
#
# :2=andrew
# :3=lisa
:1=root


5、设置显示

vi /etc/tigervnc/vncserver-config-defaults 
geometry=2000x1200
session=gnome


6、创建服务

systemctl daemon-reload
systemctl enable --now vncserver@:1.service


7、重启服务

systemctl restart vncserver@:1.service