Installing VNC Server on CentOS 7

VNC logo


VNC allows you to connect to your server or computer remotely using a graphical user interface.


Installing The VNC Server:

Install the CentOS desktop

yum groupinstall "GNOME Desktop"

Install the VNC server

yum install -y tigervnc-server


Create a new user to connect remotely to your server, you can use root, but it’s highly not suggested due to security risks.
useradd vncuser
passwd vncuser


Copy the generic VNC service file to the service system directory.
By default VNC runs on port 5900. 4 in vncserver@:4.service will tell VNC to run on port 5904, this is useful when several VNC servers for different users need to be created.
cp /usr/lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:4.service

Edit the service file

vi /etc/systemd/system/vncserver@:4.service


Add/Modify the below in [service] (You may use a different resolution if you wish):
ExecStart=/sbin/runuser -l vncuser -c "/usr/bin/vncserver %i -geometry 1280x800 -nolisten tcp"

Reload systemd (system daemons) to scan for new or changed service file(s).

systemctl daemon-reload


Enable the service:

systemctl enable vncserver@:4.service

Create the configuration files for the VNC user and set a password when asked:

su vncuser

Start the VNC server:

systemctl start vncserver@:4.service

Configure centOS 7 firewall

firewall-cmd --permanent --zone=public --add-service vnc-server
firewall-cmd --reload

Connecting to VNC Remote Server From Windows using Putty:

Download and install VNC client from here

By default, VNC doesn’t provide a free way to connect over an encrypted connection.

We will use PuTTY to tunnel the connection from our computer to the server:

Download PuTTY from here if you don’t have it.

Enter the IP address of your server in the Host Name. Make sure to replace by your server’s IP addres.

Putty Host Name or IP

Go to Connection => SSH => Tunnels, enter the source port number (5904 in this example) and enter the IP of the server and the VNC port (IP:PORT ( in this example).

Tunneling with Putty

Make sure to replace by your server’s IP address

Click Open and login to your server.

Open VNC client and connect to localhost with the port number you specified in PuTTY.

Congratulations, you should be able to see your remote desktop!

If you are using Linux, you can install Remmina and the remmina-plugin-vnc and connect to the vnc server.

Questions or Comments? Please leave them below!


Leave a Reply

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