Bobcares

How to Install and Configure TigerVNC Server on CentOS 7

by | Oct 16, 2020

Are you looking for steps to install TigerVNC server CentOS 7? Take a peek at this blog.

Here at Bobcares, we have seen several such CentOS related installations as part of our Server Management Services for web hosts and online service providers.

Today we’ll take a look at how to install TigerVNC server CentOS 7.

 

Know more about TigerVNC

VNC (Virtual Network Computing) is a server-client protocol. It mainly allows a user to remotely connect and control a distant system by using the resources provided by the Graphical User Interface.

TigerVNC is a high-speed version of VNC based on the RealVNC 4 and X.org codebases. It provides the better performance necessary to run 3D and video applications.

Moreover, it provides extensions for advanced authentication methods and TLS encryption.

 

How to install TigerVNC server on CentOS 7

Now let’s see how our Support Engineers install TigerVNC on CentOS 7.

 

Step 1: Install and Configure VNC Server in CentOS 7

Tigervnc-server is a program that executes an Xvnc server and starts parallel sessions of Gnome or other Desktop Environment on the VNC desktop.

Run the below command to install the TigerVNC server in CentOS 7

$ sudo yum install tigervnc-server

2. After installing the program, log in with the user you want to run the VNC program. Then run the below command in the terminal so that you can configure a password for the VNC server.

$ su - your_user # If you want to configure the VNC server to run under this user directly from CLI without switching users from GUI
$ vncpasswd

3. Next, add a VNC service configuration file for your user via a daemon configuration file placed in systemd directory tree. For that, run the below command.

# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service

4. Then 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 example.

The value of 1 after @ sign represents the display number (port 5900+display). Also, for each started VNC server, the port 5900 will be incremented by 1.

# vi /etc/systemd/system/vncserver@\:1.service

Now add the below to file vncserver@:1.service.

[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/sbin/runuser -l my_user -c "/usr/bin/vncserver %i -geometry 1280x1024"
PIDFile=/home/my_user/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

[Install]
WantedBy=multi-user.target

5. After making proper changes to the VNC service file, reload systemd system initialization program to pick up the new VNC configuration file and start the TigerVNC server.

Also, make sure to check the VNC service status and enable the VNC daemon system-wide by running the below commands.

# systemctl daemon-reload
# systemctl start vncserver@:1
# systemctl status vncserver@:1
# systemctl enable vncserver@:1

6. In order to list the opened ports that are in the listening state, run the ss command as below.

# ss -tulpn| grep vnc

7. Then to allow external VNC clients to connect to the VNC server in CentOS, ensure that the proper VNC open ports are allowed to pass through your firewall.

# firewall-cmd --add-port=5901/tcp
# firewall-cmd --add-port=5901/tcp --permanent

 

Step 2: Connecting to CentOS Desktop via VNC Client

1. The remote Graphical User Interface VNC connections can be performed from almost any operating system with a GUI and a specialized VNC client as it is a platform-independent protocol.

A popular VNC client that is fully compatible with the Linux TigerVNC server, is the RealVNC VNC Viewer.

In order to remotely connect to CentOS Desktop from a Microsoft OS via VNC protocol, open the VNC Viewer program, add the IP address and port number of CentOS VNC server, and hit enter.

After establishing a VNC connection, a warning message appears saying that the connection is not encrypted.

2. In order to get rid of the warning hit the Continue button. Then add the password setup for the VNC server at point 2 and you should be remotely connected to CentOS Desktop with the user configured to run the VNC server instance.

3. If a new Authentication message appears on the screen and your user has no root privileges, just hit the Cancel button to continue to CentOS Desktop.

4. In order to remotely connect to CentOS Desktop via VNC protocol from other CentOS Desktop, first make sure that the vinagre package is installed on your system. If not, you can install it by running the below command.

$ sudo yum install vinagre

5. Then to open the vinagre utility, go to Applications -> Utilities -> Remote Desktop Viewer.

6. To remotely connect to a CentOS Desktop, hit on the Connect button, select VNC protocol from the list and add the IP address and port (5900+display number) of the remote VNC server. Also, enter the password set up for the VNC user.

7. Another popular VNC client for Linux based platforms is Remmina. It is a remote desktop client that is used in Debian-based distributions that run the GNOME desktop environment.

Run the below command to install Remmina Remote Desktop client in Debian based distros.

$ sudo apt-get install remmina

 

Step 3: Configure Multiple VNC Sessions in CentOS 7

1. In case, if you wish to run a new parallel VNC session under the same user, open a Terminal console, log in with the user you want to start the new VNC session, and run the below command.

$ vncserver

2. The new VNC sessions will open the next available VNC based ports. Then to display the open ports, execute the below ss command.

$ ss -tlpn| grep Xvnc

3. Now, remotely connect to CentOS Desktop using this new VNC session, supply the IP: port combination (192.168.1.23:5903) in VNC client

Then to stop the VNC server instances, run the below command.

$ su - your_user
$ killall Xvnc

It will destroy all started VNC instances owned only by the user who started them.

[Need any further assistance with CentOS queries? – We’re available to help you]

 

Conclusion

Today, we saw how to install TigerVNC server CentOS 7.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

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

Never again lose customers to poor
server speed! Let us help you.