How to Install VNC Server on CentOS 7

In this article, we will have explained the necessary steps to install and configure VNC Server on CentOS 7. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

VNC (Virtual Network Computing) is a Server-client protocol, which allows user accounts to connect and control a remote platform supplied by the Graphical User Interface.

Install VNC Server on CentOS 7

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

Step 2. Install Gnome desktop.

Before installing the VNC server, you would need install Gnome desktop using YUM command:

Step 3. Installing VNC Server.

Type the following command to install TigerVNC on your CentOS server:

Step 4. Configure VNC Server.

First, add a VNC service configuration file for your user via a daemon configuration file placed in systemd directory tree:

Next step edit the copied VNC template configuration file from /etc/systemd/system/ directory and replace the values to reflect your user as shown in the below sample:

Add the following lines to file file vncserver@:1.service:

After you’ve made the proper changes to VNC service file, reload systemd system initialization program to pick up the new vnc configuration file and start the TigerVNC server:

Step 5. Set the Firewall Rule if firewall is enabled on your Linux server.

In case just one instance of VNC server is started, you only need to open the first allocated VNC port: 5901/TCP by issuing the below commands to apply the firewall configuration at runtime:

Step 6. Connecting to CentOS Desktop via VNC Client.

In this example we’ll be using TigerVNC. Open your VNC viewer, enter localhost:5901 and click on the Connect button.

Install VNC Server on CentOS 7

Congratulation, you have learned how to install and configure VNC server on CentOS 7. If you have any question, please leave a comment below.