Install & Configure VNC Server in CentOS 7 and RHEL 7

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.

In this article we will go through the installation and configuration of VNC Server on CentOS 7 / RHEL 7.

Step:1 Make Sure the Desktop Packages are installed

In order to setup VNC server first we make sure that Desktop is installed ,in My case i am using Gnome Desktop. If Gnome Desktop is not installed on your Linux machine then use the below command to install.

 [root@linuxtechi ~]# yum groupinstall "GNOME Desktop"

Step:2 Install Tigervnc and other dependency Package.

 [root@linuxtechi ~]# yum install tigervnc-server xorg-x11-fonts-Type1

Step:3 Setup VNC Server Configuration File.

Copy the VNC config file “/lib/systemd/system/vncserver@.service” to the “/etc/systemd/system/vncserver@:<Port_Number>.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>

 [root@linuxtechi ~]# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:3.service

Step:4 Update the User’s Information in the Config File

[root@linuxtechi ~]# vi /etc/systemd/system/vncserver@:3.service


Replace the “linuxtechi” user as per your requirement. In my case linuxtechi user will able to control and manage its desktop session using remote VNC clients.

Set the Firewall Rule if firewall is enabled on your linux box.

[root@linuxtechi ~]# firewall-cmd --permanent --zone=public --add-port=5903/tcp
[root@linuxtechi ~]# firewall-cmd --reload
[root@linuxtechi ~]#

Step:5 Set the VNC password for the User.

Switch to the user (linuxtechi) and run vncserver command to set the password as shown below :


Start and Enable the VNC Service at boot.

Execute below commands as root only.

[root@linuxtechi ~]# systemctl daemon-reload
[root@linuxtechi ~]# systemctl start vncserver@:3.service
[root@linuxtechi ~]# systemctl enable vncserver@:3.service
ln -s '/etc/systemd/system/vncserver@:3.service' '/etc/systemd/system/'
[root@linuxtechi ~]#

Step:6 Access Remote Desktop Session.

From Ubuntu Machine :

ubuntu@localhost:~$ vncviewer

Enter the VNC password that we have set in above step, after validating the authentication Remote Desktop session will start.

From Windows Machine Using VNC Viewer

Enter the VNC Server IP Address and Port Number and then Click on OK


Enter the VNC Password & then click on OK.


Desktop Session Will start after authentication.


7 Responses

  1. José Luis Alonso says:


    I’m from Mexico. Thank you for your post. This is a good post, i can to installed and configured the vncserver

  2. Aravindh says:

    Hi Pradeep, Thank you for your post.It worked for me. once again thanks. 🙂

  3. Pablo says:

    Hi there! Great job, easily explained. Works perfect.

  4. David Livingstone says:

    I did everything Exactly by the book, and ended here:
    [root@OptiPlex-380 ~]# systemctl daemon-reload
    [root@OptiPlex-380 ~]# systemctl start vncserver@:3.service
    Job for vncserver@:3.service failed because the control process exited with error code. See “systemctl status vncserver@:3.service” and “journalctl -xe” for details.
    [root@OptiPlex-380 ~]# systemctl status vncserver@:3.service
    ● vncserver@:3.service – Remote desktop service (VNC)
    Loaded: loaded (/etc/systemd/system/vncserver@:3.service; disabled; vendor preset: disabled)
    Active: failed (Result: exit-code) since Tue 2016-05-17 09:45:47 AEST; 44s ago
    Process: 1238 ExecStart=/usr/sbin/runuser -l david -c /usr/bin/vncserver %i (code=exited, status=2)
    Process: 1232 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)

    May 17 09:45:47 OptiPlex-380 systemd[1]: Starting Remote desktop service (VNC)…
    May 17 09:45:47 OptiPlex-380 systemd[1]: vncserver@:3.service: control process exited, code=exited status=2
    May 17 09:45:47 OptiPlex-380 systemd[1]: Failed to start Remote desktop service (VNC).
    May 17 09:45:47 OptiPlex-380 systemd[1]: Unit vncserver@:3.service entered failed state.
    May 17 09:45:47 OptiPlex-380 systemd[1]: vncserver@:3.service failed.

    Any hints? I’ve checked the forums I could find, with no clue. Any help greatly appreciated.

  5. Steve says:

    Followed you instructons for RHEL7, connected from Win7 laptop. Works perfect. Thanks!

  6. Magesh Mahi says:

    Worked Like a Charm in Centos 7 windows 10 laptop remoting into it …

Leave a Reply

Your email address will not be published. Required fields are marked *