Step 1: Install the GUI server
$ sudo yum group install "Server with GUI" -y
Step 2: Install VNC Server
$ sudo yum install tigervnc-server tigervnc-server-module -y
Step 3: Create a password for vncserver
$ vncpasswd
Step 4: Copy vncserver@.service to /etc/systemd/system/
$ sudo cp /usr/lib/systemd/system/vncserver@.service /etc/systemd/system/.
Step 5: Edit /etc/systemd/system/vncserver@.service for Linux user.
$ sudo vi /etc/systemd/system/vncserver@.service
Search for below line and replace <USER> with opc as mentioned
ExecStart=/usr/bin/vncserver_wrapper opc %i -geometry 1366x768
Step 6: Starting VNC Server
$ sudo systemctl daemon-reload
$ sudo systemctl start vncserver@:1.service (Here :1 is the port of vncserver)
$ sudo systemctl enable vncserver@:1.service
$ sudo systemctl status vncserver@:1.service
Step 7: Tunneling VNC server port onto localhost (use Git Bash, in case of Windows OS)
$ ssh -v -C -L 5901:localhost:5901 opc@<public_ip> -i <private_key>
Step 8: Connect to VNC session using "localhost:5901"
// We can also access the VNC session directly, by opening 5901 open in Linux firewall.
Step 7a: Open port '5901' in the firewall configuration.
$ sudo firewall-cmd --zone=public --permanent --add-port=5901/tcp
$ sudo firewall-cmd --reload