How To Setup TigerVNC To Connect Remote Server Graphically On RHEL/CentOS 7?

How To Setup TigerVNC To Connect Remote Server Graphically On RHEL/CentOS 7?

In this tutorial, we will learn how to install and configure a TigerVNC server on CentOS 7 but before moving to future let’s know what is VNC

What is VNC?

VNC stands for Virtual Network Computing running on default port 5900. VNC is a platform-independent protocol which facilitates a user to connect to a remote system or computer graphically. In simple words, you get a remote desktop like windows have a remote desktop in a GUI mode.

All the command, mouse and keyboard strokes are transmitted over the network to the remote is available for OS X, Linux, and other operating systems.


Host OS: CentOS/RHEL 7 (Minimal Install)
Host IP:
RAM: 4GB Memory
Home Dir: /home/vncuser

Note: If you are a SUDO user then prefix every command with sudo, like #sudo ifconfig

So Let’s Start

Step 1: Create A User Account

First, we need to create a user account. This user account will be used for connecting our CentOS servers remotely by VNC clients. Run the below command to create a user

Step 2:  Install GUI On VNC Server

To get connect with a remotely we need a GNOME or GUI install on the server and a per our scenario we have server with minimal install so we must run the following command to install GNOME

This can take a few minutes and Once the package group is installed, reboot the server using below command

Note: if you already have a GUI installed on your system then you may skip this step

Troubleshooting(Sometimes Only)

After reboot, if your Server Stuck at below given screen so follow the steps given below

How To Setup TigerVNC To Connect Remote Server Graphically On RHEL/CentOS 7

Press 1 (license read),
Then 2 (accept license),
Then C (to continue).
You may have to press C two or more times. As shown in above image

Step 3: Install TigerVNC Server

TigerVNC is the open source software and we will use the same that will allow us to make a remote desktop connection. So, run the following command to install

Now we have successfully installed VNC server GNOME desktop installed.

Step 4: Configuring VNC Client/User

When you are using VNC then every user connecting via VNC will start a new service or instance. VNC doesn’t run as one single process.

So, now we will start a new instance of VNC server for a user. So, let’s make a copy of /lib/systemd/system/[email protected] file to create our user service file using below command.

Now let’s edit the file to create separate service for our client.

now look for the [Service] section and replace <USER> with vncuser and add the -geometry 1280×1024 clause at the end of the ExecStart parameter. After editing your file should look like below file

Now save and exit the file using :wq!

Step 5: Start Service

Run the following commands to reload the systemd daemon an enabling vncserver to get started after every reboot

Step 6: Configuring Your Firewall

Now if you have a running firewall service on your server then you must follow this step else you may skip if iptables and firewall are down/not running on your system. You may check the status using command

The output if the firewall is running so Now we will allow VNC traffic through ports 5904, 5905only. so run the following command to allow 5904 and 5905(if looking for one more port)

Now Reload the firewall:

Step 7: Setup VNC Passwords

Now we only have to setup VNC password, to do that the users(vncuser) have to login into another terminal to the CentOS 7 server via vncuser.

and execute the following command and you will be prompted for a password so type new your password (it’s not your Linux user password so chose a different one)

Well, you will notice many files are being created in the home directory

Now get back to your main terminal session(root) and run the following command

With Ths last command executed you have successfully setup VNC server and in next part, we will learn how to connect VNC server using the VNC client.

Must Read: