The following are instructions on how to install TigerVNC Server on a RedHat Linux workstation so it can be accessed remotely using a VNC Viewer.
1. Install Tiger VNC Server:
su
yum install tigervnc-server*
2. Create configuration file for the VNC Service:
vi /etc/systemd/system/
vncserver@\:2.service
or
nano /etc/systemd/system/vnserver@\:2.service
Note: On the configuration file, replace the user, group, and WorkingDirectory for the user that will be access this server remotely.
3. Modify GDM Custom Configuration:
nano /etc/gdm/custom.conf
or
vi /etc/gdm/custom.conf
4. Create or Modify the xstartup file:
vi /home/ddeocampo/.vnc/xstartup
or
nano /home/ddeocampo/.vnc/xstartup
Note: make sure exec /X11/xinit/xinitrc is added to the configuration to prevent the blank screen issue: some people experience a blank screen when connecting to a VNC server. Also, ensure x-window-manager & is also included at the bottom of the configuration file.
5. Restart the daemon:
systemctl daemon-reload
6. Enable the VNC Service:
systemctl enable vncserver@\:2.service
7. Setup VNC password for user account:
8. Start or Restart the Service
systemctl start vncserver@\:2.service
or
systemctl restart vncserver@\:2.service
9. You Can Verify the VNC Service’s Status:
systemctl status vncserver@\:2.service
10. Disable Selinux:setenforce 0
sed -i 's/enforcing/disabled/g' etc/selinux/config
11. Configure the Selinux Config file:
vi /etc/selinux/config
or
nano /etc/selinux/config
Note: change SELINUX=permissive to SELINUX=disabled:
12. To Check Selinux Status:sestatus
13. To Find TCP Port(s) the VNCServer is using, use the following command:ss -tulnp | grep 590*
Note: As you can see, Xvnc in this example is configured for 5902 and 5903. Your port can be different but it will start with 590.
14. Open VNC Port(s) on Firewall:firewall-cmd --permanent --zone=public --add-port=5903/tcp
15. Other commands You May Need:
firewall-cmd --reload //restarts the firewall daemon
sysctl stop firewalld //stops the firewall daemon
systemctl status firewalld //checks the firewall status
firewall-cmd --state //checks the firewall state
16. Or you can install firewall-config to view firewall settings through a GUI interface:
firewall-config
17. Start the VNCService:
systemctl start vncserver@\:2.service