=== 1 install vnc server ===
yum install tigervnc-server
=== 2 add vnc user ===
useradd vic
passwd vic #change password
=== 3 make config file for the specific user ===
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
edit the config file
vim /etc/systemd/system/vncserver@:1.service
content of the config file should be
[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/sbin/runuser -l vic -c "/usr/bin/vncserver %i"
PIDFile=/home/vic/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
=== 4 change filewall settings ===
firewall-cmd --permanent --zone=public --add-service vnc-server
firewall-cmd --reload
=== 5 start the vac server as the specific user ===
su - srijan
vncserver
=== 6 make vnc server start during boot time ===
su -
systemctl daemon-reload
systemctl enable vncserver@:1.service
reboot
systemctl start vncserver@:1.service