How to install VNC Server on CentOS

Virtual Network Computing or VNC is a graphical-based tool that can help you to control a computer remotely. This guide shows you how to setup and configure VNC on CentOS.

Virtual Network Computing or VNC is a graphical-based tool that can help you to control a computer remotely. The computer being controlled is termed as VNC Server, and the machine that’s controlled from is called a VNC Client.

In this tutorial, we are going to cover how to install and configure a VNC Server on CentOS machine. Also, at the end of this tutorial, we will show you how to connect to a VNC Server.

Installing VNC Server on CentOS

Step 1. Before starting in the installation of the VNC Server, we need first to make sure you have a graphical Desktop installed on your CentOS machine.

To get your currently installed graphical Desktop name use the next command:


Check Currently Installed Desktop
Check Currently Installed Desktop

In case you have no graphical Desktop installed, use the following command to install the Gnome Desktop:

sudo yum groupinstall "GNOME Desktop"

Step 2. To install a VNC Server, we will install the “tigervnc-server” package. Also, we will install some other dependency package.

sudo yum install tigervnc-server xorg-x11-fonts-Type1

Install Tigervnc Package
Install Tigervnc Package

Step 3. To configure the VNC Server, we will copy the VNC configuration file that is located in “/lib/systemd/system/vncserver@.service” to the new location “/etc/systemd/system/vncserver@:<Port_Number>.service”. Where the <Port_Number> is the port number that we need the VNC service to listen on. We can specify the port number using one of the next methods:


Next, we will copy the VNC configuration file using the next command:

sudo cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:3.service

Copy The VNC Server Configuration File
Copy The VNC Server Configuration File

Step 4. Edit the VNC configuration file using your favorite editor.

sudo vi /etc/systemd/system/vncserver@:3.service

Open The VNC Server Configuration File
Open The VNC Server Configuration File

Then replace the user tag with the user that will be able to remotely control the desktop via the VNC client like the below screenshot.

Edit The VNC Server Configuration File
Edit The VNC Server Configuration File

Step 5. Add a new firewall rule using the next command.

sudo firewall-cmd --permanent --zone=public --add-port=5903/tcp

Add Firewall Rules
Add Firewall Rules

Then reload the firewall using the following command.

sudo firewall-cmd --reload

Reload New Firewall Rules
Reload New Firewall Rules

Step 6. Now switch to the user whom you set in the VNC configuration file. Then execute the next command to set the password for VNC client authentication.


Set A VNC Password
Set A VNC Password

Step 7. Next, start the VNC service and enable it at the boot.

sudo systemctl daemon-reload
sudo systemctl start vncserver@:3.service
sudo systemctl enable vncserver@:3.service

Enable VNC Server At Boot
Enable VNC Server At Boot

Step 8. Finally, get the machine IP using the next command.


VNC Server IP
VNC Server IP

Step 9. Now to test VNC Server, from your Windows machine and using the VNC viewer. Enter your VNC Server IP and port like the below screenshot.

Connecting To VNC Server
Connecting To VNC Server

Press continue button to skip the unencrypted connection warning.

VNC Encryption
VNC Encryption

Next, enter the VNC password and press OK.

Password Authentication For VNC
Password Authentication For VNC

Finally, you will be able to access the VNC Server.

Connected To VNC Server
Connected To VNC Server

Congratulations you have installed and configured the VNC Server on your CentOS machine. Now you can start exploring your CentOS remotely.

Hend Adel
Hi! I'm Hend Adel, a freelancer technical geek with successful experience in Database, Linux and many other IT fields. I help to build solutions to suit business needs and creating streamlined processes. I love Linux and I'm here to share my skills via FOSS Linux! Thanks for reading my article.


Please enter your comment!
Please enter your name here




How to install CMake on Ubuntu

CMake is a cross-platform free and open-source software tool designed to build, test, and package the software. CMake uses a simple platform and compiler-independent configuration files to control the software compilation process.

How to install Lightworks on Ubuntu

Even though Linux may not get a native installer of video editing software like Adobe Premiere or Final Cut Pro, that doesn't mean there are no industry standards tools available. Lightworks is non-linear editing (NLE) video mastering app for Windows, Linux, and macOS. Installing it on Ubuntu is simple due to deb package availability.

How to install DaVinci Resolve on Fedora

Davinci Resolve is a professional application used for color correction, video editing, visual effects, and motion graphics. It is one of the extensively used software by movie industries located in Hollywood.

The 10 Best Programming Languages for Hacking

One of the significant entities we have in Cyber Security is Ethical Hacking (ETH). It is the process of detecting and finding flaws or vulnerabilities in a system that a hacker would exploit.

5 Ways to Open a Terminal in Ubuntu

Even though Ubuntu supports many applications with amazing Graphical User Interfaces (GUI), there are always reasons why users prefer using the Terminal to perform different tasks.

How to install Wine on Fedora Workstation

Linux distributions are becoming more and more popular every day, and Fedora Workstation is not left behind. This popularity brings forth the need to run Windows applications on Linux distros like Fedora. Windows has quite some excellent Software that is not available for Linux.


Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.
Elementary OS 5.1 Hera has received a point release with a handful of new features and bug fixes, and we will be reviewing the significant changes in this article. For those new to elementary OS, this Ubuntu-based Linux distribution uses their inhouse built Pantheon desktop environment and AppCenter.

[Guide] apt vs apt-get commands, and which one to use?

Most Linux users, both veterans, and newbies, often get confused about what the difference between the Linux commands apt, and apt-get are and when they should use one or the other.

Top 20 must-have apps for your Ubuntu PC

OK, this one is going to be a long one, so grab a cup of coffee and scroll through the best apps that we think are must-have for your Ubuntu PC. We have hand-picked each one of these considering the most common categories that suit an average Linux user.

5 Best Download Managers for Linux

We often need to download large files that can go corrupt due to various reasons such as slow internet or interrupted download. Using a broken downloaded file is not something one wants. Download managers make sure that the downloaded file maintains its integrity and also presents you with the ability to pause and resume downloads, provided the server supports it. When you are downloading a massive file, it's recommended to use a download manager.

All about Ubuntu editions and which version should you use?

Ubuntu is one of the most popular Linux distributions developed and released by Canonical, and not without reason. It has very enriched repositories, with support for all the programs you could ever need.