1080*80 ad

How to Install VNC Server on Rocky Linux 8

Setting up remote access to your server can be incredibly useful for administration or running graphical applications. A popular method for achieving this is using VNC (Virtual Network Computing). This guide walks you through installing and configuring a VNC server on a Rocky Linux 8 system, allowing you to control your server’s desktop environment from a remote machine.

First, ensure your system is up to date. Open a terminal and run the following command:
sudo dnf update -y

VNC requires a graphical desktop environment to function. If your Rocky Linux 8 installation is minimal or server-only, you’ll need to install one. A common choice is GNOME. Install it using:
sudo dnf groupinstall “Server with GUI” -y
After installation, you might need to reboot or switch the system target to graphical mode permanently:
sudo systemctl set-default graphical
sudo reboot (if you changed the target)

Now, install the VNC server software. The tigervnc-server package is widely used and reliable:
sudo dnf install tigervnc-server tigervnc-server-module tigervnc-utils -y

Next, you need to set a VNC password for the user account you will use to connect. Log in as that user (or use sudo -u username vncpasswd) and run:
vncpasswd
You will be prompted to enter and verify a password, and optionally set a view-only password.

To make the VNC server run as a systemd service for your user, you’ll create a service unit file. This file tells systemd how to start the VNC server for a specific user on a specific display number (commonly :1). Copy the template service file:
sudo cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:1.service
Now, edit the copied file to replace the placeholder user and configure the startup. Replace User=, Group=, PIDFile=, and the ExecStart and ExecStop lines within the [Service] section with the appropriate username (replace yourusername):
sudo nano /etc/systemd/system/vncserver@:1.service
Modify the relevant lines to look something like this (example for user rockyuser):
User=rockyuser
Group=rockyuser
PIDFile=/home/rockyuser/.vnc/%H%i.pid
ExecStart=/usr/bin/vncserverwrapper rockyuser %i
ExecStop=/usr/bin/vncserver
wrapper rockyuser -kill %i

Save the file (Ctrl+X, Y, Enter in nano). Reload systemd to recognize the new service file:
sudo systemctl daemon-reload

You can now start the VNC server service for your user on display :1:
sudo systemctl start vncserver@:1
Verify its status:
sudo systemctl status vncserver@:1
To ensure the VNC server starts automatically on boot, enable the service:
sudo systemctl enable vncserver@:1

The VNC server listens on specific ports, typically 5900 + display number. For display :1, the port is 5901. You need to allow this port through the firewall:
sudo firewall-cmd –permanent –add-port=5901/tcp
sudo firewall-cmd –reload

Finally, connect to your VNC server. On your remote machine, use a VNC client application and connect to your Rocky Linux 8 server’s IP address or hostname followed by the display number (e.g., your_server_ip:1 or your_server_ip:5901). Enter the VNC password you set earlier.

You should now see and interact with the desktop environment running on your Rocky Linux 8 server. Remember to secure your connection, perhaps by tunneling VNC over SSH for added security.

Source: https://kifarunix.com/install-vnc-server-on-rocky-linux-8/

900*80 ad

      1080*80 ad