VNC Server Setup on Rocky Linux 8.4 (Red Hat 8.4 Variants)

These instructions worked for me on Rocky Linux 8.4. The configuration instructions for various Red Hat 8.X VNC server setups have varied substantially over the 8.X versions.

These instructions do not involve setting up an encrypted data channel. Only use this setup on a known secure local network or consider using a SSH tunnel between the client and server.

The graphical system needs to be running at bootup:

systemctl set-default graphical.target

Install the VNC server binaries:

dnf install tigervnc-server

Configure the firewall to accept connections to the port:

Note: The following steps are done per user changing the port number for each user: ‘1’ = port 5901, ‘2’ = port 5902, etc.

 firewall-cmd --get-default-zone
 firewall-cmd --permanent --zone=public --add-port 5901/tcp
 firewall-cmd --reload 

Create the VNC user password:

 su - <username>
 vncpassword   
     Note: View Only = "n" 

Create a port mapping per user:

 echo ':1=<username>' >> /etc/tigervnc/vncserver.users

Create a systemd unit file:

 cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service 

Enable and start the VNC service:

 systemctl enable vncserver@:1.service
 systemctl start vncserver@:1.service 

Get server status:

 systemctl status vncserver@:1.service