How To Install VNC Server On CentOS 7

Vncserver is a remote display daemon that allows users several remote functionalities including:

  1. Virtual (headless) and fully parallel X sessions that run in the background (i.e. not on the physical monitor but virtually) on a machine. All applications running under the server may continue to run, even when the user disconnects.
  2. Direct control of the local X session(s) (i.e. X running on the physical monitor).
Machine: Vmware Centos 7 Guest
IP =

Install vnc server on CentOS 7

Add vnc user:

 [[email protected] ~]# add pirat9

Set password for pirat9 user:

 [[email protected] ~]# passwd pirat9

Lets Start:

 [[email protected] ~]# yum check-update
 [[email protected] ~]# yum groupinstall "GNOME Desktop"
 [[email protected] ~]# unlink /etc/systemd/system/
 [[email protected] ~]# ln -sf /lib/systemd/system/ /etc/systemd/system/
 [[email protected] ~]# reboot

After reboot, you will get Centos 7 desktop.

Now start installing VNC packages.

Step 1 » install VNC package.

[[email protected] ~]# yum install tigervnc-server xorg-x11-fonts-Type1 -y

Step 2 » Create a file ‘[email protected]:1.service’ in /etc/systemd/system/ directory by copying example config file /lib/systemd/system/[email protected]

[[email protected] ~]# cp /lib/systemd/system/[email protected] /etc/systemd/system/[email protected]:1.service

Step 3 » Now open /etc/systemd/system/[email protected]:1.service file and replace with your username .

Find these lines:

 ExecStart=/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"

Replace (username as pirat9):

 ExecStart=/sbin/runuser -l pirat9 -c "/usr/bin/vncserver %i"

Or root user:

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

Step 4 » Reload systemd for changes.

[[email protected] ~]# systemctl daemon-reload

Step 5 » Create VNC password for the user .

 [[email protected] ~]# vncpasswd

Step 6 » Enable and start the service using the below commands.
Enable service at startup ( Permanent ).

 [[email protected] ~]# systemctl enable [email protected]:1.service
 Start the service .
 [[email protected] ~]# systemctl start [email protected]:1.service

Step 7 » Allow VNC service in firewall.

 [[email protected] ~]# firewall-cmd --permanent --add-service vnc-server
 [[email protected] ~]# systemctl restart firewalld.service

Now you can able to connect VNC server using IP and Port.