Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and configure VNC server on Centos 8/RHEL 8

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to install and configure the VNC server on Centos 8/RHEL 8. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.

VNC (Virtual Network Computing Virtual Network Computing) server is a desktop sharing platform based on GUI, which allows you to access remote desktop computers. On Centos 8 and RHEL 8 systems, the VNC server is not installed by default and needs to be installed manually. In this article, we will go through a simple step-by-step guide to how to install a VNC server on Centos 8 / RHEL 8.

Prerequisite requirements for installing a VNC server on Centos 8 / RHEL 8

To install a VNC server on your system, make sure that your system meets the following requirements:

CentOS 8 / RHEL 8

GNOME desktop environment

Root user rights

DNF / YUM software package repository

Step-by-step instructions for installing a VNC server on Centos 8 / RHEL 8 step 1) install the GNOME desktop environment

Before installing the VNC server in CentOS 8 / RHEL 8, make sure that the desktop environment (DE) is installed. If you already have GNOME Desktop or GUI support installed, you can skip this step.

In CentOS 8 / RHEL 8, GNOME is the default desktop environment. If you don't have it on your system, use the following command to install it:

[root@linuxtechi ~] # dnf groupinstall "workstation" or [root@linuxtechi ~] # dnf groupinstall "Server with GUI

After successfully installing the above package, run the following command to enable graphical mode:

[root@linuxtechi ~] # systemctl set-default graphical

Now restart the system and go to the GNOME login page (LCTT: you can enter the graphical interface by switching between running modes).

[root@linuxtechi ~] # reboot

After reboot, uncomment the WaylandEnable=false in / etc/gdm/custom.conf so that remote Desktop session requests through vnc are handled by xorg on the GNOME Desktop instead of the Wayland display Manager.

Note: Wayland is the default display Manager (GDM) in GNOME, and API is not configured to handle remote renderings such as X.org.

Step 2) install the VNC server (tigervnc-server)

Next, we will install the VNC server, there are many VNC servers to choose from, and for installation purposes, we will install the TigerVNC server. It is one of the most popular VNC servers, and its high performance is platform independent, making it easy for users to interact with remote computers.

Now, install the TigerVNC server using the following command:

[root@linuxtechi ~] # dnf install tigervnc-server tigervnc-server-module-y step 3) set the VNC password for the local user

Suppose we want user pkumar to use VNC for a remote desktop session, then switch to that user and use the vncpasswd command to set their password

[root@linuxtechi] # su-pkumar [root@linuxtechi ~] $vncpasswdPassword:Verify:Would you like to enter a view-only password (yzone)? NA view-only password is not used [root@linuxtechi ~] $[root@linuxtechi ~] $exitlogout [root@linuxtechi ~] # step 4) set the VNC server configuration file

The next step is to configure the VNC server profile. Create a / etc/systemd/system/vncserver@.service with the following to start the tigervnc-server service for the local user pkumar above.

[root@linuxtechi ~] # vim / etc/systemd/system/vncserver@ .service[ Unit] Description=Remote Desktop VNC ServiceAfter=syslog.target network.target [Service] Type=forkingWorkingDirectory=/home/pkumarUser=pkumarGroup=pkumar ExecStartPre=/bin/sh-c'/ usr/bin/vncserver-kill% I > / dev/null 2 > & 1 | |: 'ExecStart=/usr/bin/vncserver-autokill% iExecStop=/usr/bin/vncserver-kill% I [Install] WantedBy=multi-user.target

Save and exit the file

Note: replace the user name in the above file with your own.

By default, the VNC server listens on tcp port 5900roomn, where n displays the port number, and if the port number is "1", then the VNC server listens for its requests on TCP port 5901.

Step 5) start the VNC service and allow ports in the firewall

I will set the display port number to 1, so start and enable the vnc service on the display port number "1" using the following command

[root@linuxtechi] # systemctl daemon-reload [root@linuxtechi ~] # systemctl start vncserver@:1.service [root@linuxtechi ~] # systemctl enable vncserver@:1.serviceCreated symlink / etc/systemd/system/multi-user.target.wants/vncserver@:1.service → / etc/systemd/system/vncserver@.service. [root@linuxtechi ~] #

Use the following netstat or ss command to verify that the VNC server starts listening for requests on 5901

[root@linuxtechi ~] # netstat-tunlp | grep 5901tcp 0 0 0.0.0.0 tunlp 5901 0.0.0.0 LISTEN 8169/Xvnctcp6 0 0: 5901: * LISTEN 8169/Xvnc [root@linuxtechi ~] # ss-tunlp | grep-I 5901tcp LISTEN 0 5 0.0.0.0 5901 0.0.0.0 users: ("Xvnc" Pid=8169,fd=6)) tcp LISTEN 0 5 [::]: 5901 [:]: * users: (("Xvnc", pid=8169,fd=7)) [root@linuxtechi ~] #

Verify the status of the VNC server using the following systemctl command

[root@linuxtechi ~] # systemctl status vncserver@:1.service

Vncserver-status-centos8-rhel8

The output of the above command confirms that VNC was successfully started on tcp port 5901. Use the following command to allow VNC server port "5901" in the system firewall

[root@linuxtechi ~] # firewall-cmd-- permanent-- add-port=5901/tcpsuccess [root@linuxtechi ~] # firewall-cmd-- reloadsuccess [root@linuxtechi ~] # step 6) Connect to a remote desktop session

Now we are ready to see if the remote Desktop connection is working properly. To access remote desktops, start VNC Viewer on the Windows / Linux workstation, enter the IP address and port number of the VNC server, and press enter.

VNC-Viewer-Windows10

Next, it will ask for your VNC password. Enter the password you previously created for the local user, and then click "OK" to continue.

VNC-Viewer-Connect-CentOS8-RHEL8-VNC-Server

Now you can see the remote desktop

VNC-Desktop-Screen-CentOS8

That's it. You have successfully installed the VNC server in Centos 8 / RHEL 8.

On how to install and configure VNC server on Centos 8/RHEL 8 to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report