This guide provides a concise and reliable method to connect to a virtual machine (VM) using VNC. After reviewing multiple inconsistent tutorials, Team Shunya has compiled the exact steps required—without unnecessary details or ambiguity.
Follow the instructions below to establish a successful VNC connection to your VM.
# Update & Upgrade the packages
sudo apt update sudo apt upgrade -y
# Install XFCE -- A light weight Desktop Environment
sudo apt install xfce4 xfce4-goodies dbus-x11 xterm -y# Install tigervnc sevrver
sudo apt install tigervnc-standalone-server tigervnc-common -y
sudo apt install tigervnc-tools# Set a password for remote access
vncpasswdNow Open the Configuration File Using
nano /root/.vnc/xstartup
Copy paste the below contents in it
#!/bin/bash
xrdb $HOME/.Xresources
export XDG_SESSION_TYPE=x11
export DISPLAY=:1
exec dbus-launch --exit-with-session startxfce4
Make sure to make it executable
chmod +x /root/.vnc/xstartup
Then Launch the Server Using
# Launch the server
vncserver- Look for the port it opens for connection (Generally :5901)
- If you wish to kill any Port then use
vncserver -kill :1
-
Make sure that your server is on i.e vncserver is active
-
Download a VNC Viewer from this link VncViewer For Linux
-
You will see a interface like this
- In the Blank Area put the address like this
# [Husarnet_Connection_address]:port_number , e.g [fc94:7fde:f6cb:bb3f:5a15:44aa:xxxx:xxxx]:5901