VNC (Virtual Network Computing) Server allows the remote Desktop sharing using remote VNC clients like VNC viewer. In CentOS 7 & RHEL 7 package named “tigervnc-server” needs to be installed in order to setup the VNC server.

We will go through the installation and configuration of VNC Server on RHEL/CentOS/OEL 7

Install the following package.

# yum install tigervnc-server

Setup VNC Server Configuration File

Then copy the service file to systemd location.

#  cp /usr/lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:2.service

The browse to the directory vi /etc/systemd/system/vncsever@:2.service

While Copying the VNC config file we can mention the port number on which we want VNC service to be listen. In my case i am using port 3 , it means VNC will listen on “5903”. So while Connecting to the VNC server We can specify port number as <IP_Address_VNC_Server:3> or <IP_Address_VNC_Server:5903>

Update the User’s Information in the Config File

Make the following changes



# Clean any existing files in /tmp/.X11-unix environment

ExecStartPre=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :’

ExecStart=/usr/sbin/runuser -l root -c “/usr/bin/vncserver %i”


ExecStop=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :

Set the VNC password for the User

Allows you to set the password used to access VNC desktops (vncpasswd).Its default behavior is to prompt for a VNC password and then store an obfuscated version of this password to passwd-file (or to $HOME/.vnc/passwd if no password file is specified.) The vncserver script runs vncpasswd the first time you start a VNC desktop

Change the VNC password

# vncpasswd

Password- 12345

Retype password- 12345

Start and Enable the VNC Service at boot

Then run the following commands

systemctl daemon-reload

# systemctl start vncserver@:2.service

# systemctl enable vncserver@:2.service

Disable and stop firewall

# systemctl disable firewalld.service

# systemctl stop firewalld.service

 Connect on VNC viewer with the following credentials.

If the VNC server is successfully contacted, you will be prompted for a password to authenticate you. You can also add ’VNC_USERNAME’ and ’VNC_PASSWORD’ to environment variables.

If the password is correct, a window will appear showing the desktop of the VNC server.

Click to rate this post!
[Total: 1 Average: 5]