Wednesday, 29 October 2025

Install the VNC Remote Access Server on Oracle Linux 8.x

Virtual Network Computing (VNC) is a graphical desktop-sharing system that controls remote machines by sending keyboard and mouse events over the network. VNC is particularly useful for remotely controlling Oracle Linux servers that have a graphical desktop environment installed.

You can connect to a VNC server using any compatible software client. VNC is suitable for thin client computing where multiple dumb terminals can share the same hardware resources hosted on an Oracle Linux server.

You can use a different VNC software of your choice.

Steps for Installation and configuration.

  • Install a graphical desktop environment along with the VNC service
  • Set the VNC Password for a user on the system
  • Configure the VNC service for a specific user
  • Start and enable the VNC service across subsequent boots
  • Access the VNC server from a remote client, either directly or using an SSH tunnel
  • Optionally enable x509 encryption for direct VNC access
  • Optionally create firewall rules to allow direct VNC access

Prerequisite

  • Any system with the latest Oracle Linux installed
  • Client software such as TigerVNC/RealVNC

Install a Graphical Desktop Environment

Step1: Install a GNOME desktop environment and all of its dependencies.
#sudo dnf group install -y "Server with GUI"
Step2: Set graphical mode as the default login type for user accounts, then reboot the server.
#sudo systemctl set-default graphical
Step3: Disable Wayland in the graphical desktop.
#sudo sed '/^#WaylandEnable/s/^#//g' /etc/gdm/custom.conf

Install VNC Server and Set the VNC Password

Step1: Install the VNC server package and all of its dependencies.
#sudo dnf install -y tigervnc-server tigervnc-server-module
Step2: Create a VNC password for the user account you intend to use for remote sessions.
#vncpasswd

Configure the VNC Service

Step1: Append the user account and the X Server display for the VNC service to the /etc/tigervnc/vncserver.users file.
#echo ":1=$(whoami)"| sudo tee -a /etc/tigervnc/vncserver.users > /dev/null
Step2: Append the default desktop and screen resolution to the /etc/tigervnc/vncserver-config-defaults file.
#printf 'session=gnome\ngeometry=1280x1024' | sudo tee -a /etc/tigervnc/vncserver-config-defaults > /dev/null
Step3: You need to disable SELinux which is enforcing mode by default
#sudo setenforce 0
#sudo sed -i 's/enforcing/disabled/g' /etc/selinux/config
Step4: Reload the systemd service.
#sudo systemctl daemon-reload
Step5: Enable and start the VNC server by using X Server display 1.(Port as you want)
#sudo systemctl enable --now vncserver@:1.service
Step6: VNC service is up and running, verify that the VNC server is listening on TCP port 5901 using the netstat command.
#netstat -tlnp
Step7: Next, open the port 5901 in the system firewall service which is running by default, as shown. This allows access to VNC service from clients.(If you can disabled firewalled on server then this step not come in VNC configuration)
#firewall-cmd --permanent --add-port=5901/tcp
#firewall-cmd --reload

Open a VNC Client and Test Your Deployment

Step1: Open a terminal and connect using SSH 

The -L option enables local forwarding, which opens a local port to connect through an SSH tunnel to the remote VNC server.
ssh -L 5901:localhost:5901 oracle@<your server IP>
Step2: You can install the TigerVNC software client on your target system.
Log on to the deployed server’s GUI environment by entering <Your server IP>:5901 into the VNC Server text box and pressing the Connect button.

Step3: Enter the user’s VNC password and click the OK button.