Setup VNC server in Rocky Linux 8 [Step-by-Step]

Deepak Prasad

Rocky Linux

In this tutorial, you will learn about details of Virtual Network Computing applications in Rocky Linux 8. The main focus is to provide a guideline to the reader on how to setup VNC server in Rocky Linux 8, which is described below in detail.


What is a VNC server?

  • The VNC server is an application that provides screen-sharing services free of cost. It was developed in the 1990s by RealVNC at Cambridge and then it came into the market in 2002. It is available in almost all major operating systems such as Linux, Windows, etc.
  • Through VNC a system’s resources such as screen, mouse, keyboard can be used by another system user remotely. In other words, VNC is the easy way to access the resources and programs of a remote system (the system you want to access).
  • There are two ways in which VNC can be used (known as VNC client and VNC server). The server model needs to be installed on the system you want to control, whereas the client model will be installed on the client’s system from where you are controlling the server system.
  • When the VNC server and client are connected successfully then it asks for permission from the client by sending the server remote screen.
  • The VNC uses the Remote Buffer Protocol (RBP) for controlling a remote system. The RFB protocol passes data between client and server systems.
  • There are a lot of VNC servers available such as TightVNC, AnyDeskVNC, TigerVNC, Teamviewer, etc.  In this tutorial, all the examples of TigerVNC are given. Because TigerVNC provides free-of-cost service, native language support, and many other advantages. It is important to mention that there is no major difference if you want to use any other VNC server.


Lab Environment

I have created two virtual machines to demonstrate the setup of VNC server and Client on Rocky Linux 8. Below their detail is given.

VNC Server
IP Address:
Release: Rocky Linux 8.4

VNC Client
IP Address:
Release: Rocky Linux 8.4


For better understanding, this tutorial is divided into four major sections.

  • Setup the GUI Environment in Rocky Linux 8
  • Installing VNC server
  • Installing VNC on the Client-side (Rocky Linux)
  • Connect VNC server with GUI



Step-1: Setup the GUI Environment in Rocky Linux 8

The graphical user environment is not established in the server by default. You can establish this environment by using the commands given below.

When you connect your remote system such as Rocky Linux 8 to access Desktop Interface, you need to install a GUI environment.

The first step is to update the server in the terminal. For that use the following command and press enter key.

sudo dnf update -y

After successfully updating the server. Install epel release. By following the command below and pressing enter key at the end.

sudo dnf install -y epel- release

After that install Xfce base x. By inserting the command below and pressing the enter key.

sudo dnf groupinstall -y "Xfce" "base-x"

When the dependent libraries are installed for the graphical environment.  Then set it as the default graphical environment by giving the command below and pressing the enter key.

sudo systemct1 set-default graphical

When the installation is completed successfully then you need to reboot the system, which can be done using the following command and pressing enter key.

sudo reboot


Step-2: Install and Configure VNC on the Server-side (Rocky Linux)

The next step is to install the VNC server. You can use any of the VNC servers mentioned in the introduction. In this tutorial, TigerVNC is used for demonstration, which is free of cost. You can install tigervnc using the following command and pressing the enter key.

sudo dnf install tigervnc-server

Setup VNC server in Rocky Linux 8 [Step-by-Step]


2.1 Password Configuration

Set the password of your own choice to log in to the system by compiling the command below without the Sudo privileges and pressing enter key.

$ vncpasswd
Would you like to enter a view-only password (y/n)? n
A view-only password is not used

In the below screenshot it asked the permission from the user that “Would you like to enter a view-only password Press (Y/N)”. It means that user who accesses this password will not send their mouse clicks or keyboard strokes to the remote system.

The “view only” feature is most feasible in that sense if you want to present it to multiple people. Select N, if you want to allow the user to do changes with mouse clicks or keystrokes.


2.2 Configure Desktop Environment for VNC

After successfully setting the password, you should configure the desktop environment. So that the desktop environment automatically uses TigerVNC when it is launched.

If you are using GNOME, you need to edit the file .vnc/config. Use the command which is given below to open the “nano” text editor.

nano ~/.vnc/config

Copy and paste the commands which are given below in the file that opens.

geometry=1920 X 1200

Sample Output:
Setup VNC server in Rocky Linux 8 [Step-by-Step]

These commands are used to configure the server. Here gnome is the GUI, screen size in 1920 x 1200, you are connected to localhost with the privilege set to "always shared".


2.3 Configuration of ports for users

After executing the VNC instance on the server, you will see the argument :1: 2, :3.  :1 it means it is running on port 5901. Similarly :2, :3 represent port numbers 5902 and 5903 respectively. Nevertheless, when there are many users then you assign each port to particular users. For configuration, the file vncserver.users present in the directory /etc/tigervnc should be edited.

You can edit this file using the nano editor. Enter the following command.

sudo nano /etc/tigervnc/vncserver.users

The below screenshot will appear by giving the above command.  You can also specify :2, :3, :4. If you have multiple users.

Setup VNC server in Rocky Linux 8 [Step-by-Step]


2.4 Reload the systemd daemon

To effect the change in the system, you have to reload the daemon by inserting the following command and pressing the enter key.

systemctl daemon-reload


2.5 Start VNC server service

When all the configurations are done after the reloading of the daemon, then start the VNC server by giving the following command and pressing the enter key.

systemctl start vncserver@:1.service

To make sure that the service of VNC automatically starts at boot time, you can issue the following command and then press the enter key.

sudo systemctl enable vncserver@:1.service

To check the status of the server whether it is running or not, type the following command and press the enter key.

sudo systemctl status vncserver@:1.service


2.6 Setup the Firewall

To enable VNC in the firewall, you can give the following command and press the enter key.

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



Step-3: Installing VNC on the Client-side (Rocky Linux)

The client viewer must be installed to connect to the VNC server. The following command will be issued on the client computer for this

sudo dnf install tigervnc

The output is shown in the screenshot below. Press Y to continue the installation.

Setup VNC server in Rocky Linux 8 [Step-by-Step]

When the installation is completed, its icon is available on the Activation tab.


Step-4: Connect VNC server using vncviewer

Type vncviewer on the guest server. The following command is used to connect to the server

$ vncviewer

The below screen will appear. Click the “Options” button, then choose “Misc” tab. Further, check the “shared” option and press the OK button.

Setup VNC server in Rocky Linux 8 [Step-by-Step]



Enter the VNC server IP address as shown in the below screenshot and press Connect button.

Setup VNC server in Rocky Linux 8 [Step-by-Step]


On pressing the Connect button, a screenshot screen will appear. Now you have to provide the password you set at the time of installation.

Setup VNC server in Rocky Linux 8 [Step-by-Step]

Enter the password of vncserver which you created in the above steps to connect. Once you are connected you can now access all the resources of another computer.



The main focus of this tutorial is to provide information on how to install a VNC server such as TigerVNC on Rocky Linux 8. The main steps are establishing a graphical environment in Rocky Linux 8. The second phase is to install a VNC server and its dependent libraries. After setting up the VNC server, the VNC client needs to be installed in Rocky Linux 8. After completing all the configuration, the last step is to connect it with GUI.

Hopefully, you have understood this brief tutorial. If you still have some questions, feel free to ask.


Views: 307

Deepak Prasad

He is the founder of GoLinuxCloud and brings over a decade of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive experience, he excels in various domains, from development to DevOps, Networking, and Security, ensuring robust and efficient solutions for diverse projects. You can reach out to him on his LinkedIn profile or join on Facebook page.

Can't find what you're searching for? Let us assist you.

Enter your query below, and we'll provide instant results tailored to your needs.

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can send mail to

Thank You for your support!!

1 thought on “Setup VNC server in Rocky Linux 8 [Step-by-Step]”

Leave a Comment

GoLinuxCloud Logo

We try to offer easy-to-follow guides and tips on various topics such as Linux, Cloud Computing, Programming Languages, Ethical Hacking and much more.

Programming Languages