1. Install Gnome desktop
yum groupinstall "GNOME Desktop" "Graphical Administration Tools" -y
yum groupinstall "X Window System" "Desktop" -y
2. Install VNC Server
yum install tigervnc tigervnc-server -y
3. Configure VNC
a. The /lib/systemd/system/[email protected] copy of the document
cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:1.service
b. vncserver @:. 1.service file obtained <USER> modified to account VNC Client connection, a modified root here, PIDFILE need to modify the contents of the file as follows:
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
User=root
ExecStartPre=-/usr/bin/vncserver -kill %i
ExecStart=/usr/bin/vncserver %i
PIDFile=/root/.vnc/%H%i.pid
ExecStop=-/usr/bin/vncserver -kill %i
[Install]
WantedBy=multi-user.target
c. Set VNCServer password vncpasswd
d. Start and arranged to boot from the start VNCServer
systemctl start vncserver@:1.service
systemctl enable vncserver@:1.service
If the startup error:
Job for vncserver@:1.service failed because a configured resource limit was exceeded. See "systemctl status vncserver@:1.service" and "journalctl -xe" for details.
The /root/.vnc/xstartup in the vncserver -kill $ DISPLAY commented
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
/etc/X11/xinit/xinitrc
#vncserver -kill $DISPLAY
Or systemctl daemon-reload
Or delete /tmp/.X11-unix/ directory rm /tmp/.X11-unix/ -rf
Restart Service
vncserver -kill :1
vncserver: 1
if the firewall is enable, the following rules must be guaranteed
firewall-cmd --permanent --add-service="vnc-server" --zone="public"
firewall-cmd --reload