How To Install VNC Server on CentOS 8 / RHEL 8


The following simple guide helps you to install VNC server on CentOS 8 / RHEL 8 machines. VNC server lets you access the desktop remotely from other machines which have a client installed.

The VNC server is not installed, by default. You need to set up the VNC server manually.


The steps mentioned in this article will only work if you have enabled RHEL subscription or configured the local yum repository on your system.

Install Gnome Desktop

Before installing the VNC server, you would need to install the Gnome desktop using YUM command.

READ: Install Gnome Desktop on CentOS 8 / RHEL 8

Install VNC Server

The VNC server package is available on the base operating system repository. Here, we will install the TigerVNC server and X11 fonts packages using the YUM command.

yum install -y tigervnc-server xorg-x11-fonts-Type1

User Services

VNC server recommends the service be started as user service instead of system service. By default, systemd start the user’s service when the user logs in and stops once the user has logged out.

So, to start the service at a boot time as a user, we need to enable lingering.

loginctl enable-linger <USER_NAME>

For the user raj, the command will be:

loginctl enable-linger raj

Set VNC Password

Set VNC password after switching to your user (raj).

[raj@server ~]$ vncpasswd

Set the password.

Password:  << Enter Password
Verify:  << Re-Enter Password
Would you like to enter a view-only password (y/n)? n
A view-only password is not used

Start VNC Server

Login as your user and create the directory structure to hold the user level unit files (.service).

$ mkdir -p ~/.config/systemd/user

Copy the VNC service file from /usr/lib/systemd/user/ to ~/.config/systemd/user/ run VNC service as a user service.

$ cp /usr/lib/systemd/user/[email protected] ~/.config/systemd/user/

Reload the systemd to make systemd recognize your user’s VNC service.

$ systemctl --user daemon-reload

If you get an error like: Failed to connect to bus: No such file or directory, then run the below command.

export XDG_RUNTIME_DIR=/run/user/`id -u`

Enable the VNC service to start it automatically. Also, start the service with –now option.

By default VNC server listens on port 5900, but if we set up port-offset for VNC, we can run a VNC server on a sub-port of the default port 5900.

systemctl --user enable vncserver@:<display>.service --now

For example, if we mention display 1, the desktop will be accessible in 5901. You can connect to the VNC desktop session by specifying ipaddress:<sub-port> ( or

For this demo, I will use port 1.

$ systemctl --user enable vncserver@:1.service --now

Check the VNC service status with the below command.

$ systemctl --user status vncserver@:1.service


Add firewall a rule to allow the VNC remote desktop connection. The following rule is set to allow the port-offset 5901 mentioned in the previous step.

firewall-cmd --permanent --add-port=5901/tcp

firewall-cmd --reload

Access VNC Remote Desktop Session

Open up a VNC viewer from Windows/Linux machine and enter a remote desktop address.




You will be asked to enter the VNC session password. Enter the password that you have created earlier.

Connect To VNC Desktop
Connect To VNC Desktop

Now you should get the VNC desktop session.

VNC Desktop Session
VNC Desktop Session


In this post, you have learned how to install and configure VNC server on CentOS 8 / RHEL 8. If you have any issues or feedback, please share it in the comments section.

You might also like