Using a remote server with VNC
This guide provides a step-by-step approach to installing and configuring the TightVNC server on an Ubuntu GPU server. Follow these instructions to enable remote desktop access to your server.
Open the terminal on your Ubuntu GPU server and execute the following commands to install TightVNC Server:
sudo apt update
sudo apt install tightvncserver
To configure the VNC server for the first time, run:
tightvncserver
Upon the first launch, you will be prompted to set a password for accessing the VNC server. Enter your desired password and proceed with the confirmation. After setting up the password, the VNC server will start. Each client connection will initiate a new VNC display.
The default port for the VNC server is 5900. When asked, "Would you like to enter a view-only password (y/n)?", select 'n' to ensure full interaction capabilities with the server. Choosing 'y' would restrict you to view-only mode, disabling interaction.
By default, Ubuntu's firewall blocks port 5900, which is used by the VNC server. Open this port by running:
sudo ufw allow 5901/tcp
Next, connect to your server using a VNC client. Here’s how:
- Download and install RealVNC for your operating system from RealVNC Download Page.
- Create an account or log in if you already have one.
- Launch the installed RealVNC Viewer and log in.
To connect, enter your server's IP address followed by ':5901' in the connect field.
Upon connecting for the first time, you might encounter a grey screen. To resolve this, execute the following command in your server terminal to kill the current VNC session:

vncserver -kill :1
Then, edit the ~/.vnc/xstartup
script:
vi ~/.vnc/xstartup
Replace its contents with the following script:
#!/bin/sh
def
export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
Save and exit by typing :wq
. Now, restart the VNC server with the desired geometry:
vncserver :1 -geometry 1920x1080
This setup allows you to interact with your server using a graphical interface.
If you encounter issues or the VNC server is not listening on the expected port, use this command to check:
sudo netstat -tuln | grep 5901
This command checks if the VNC server is listening on port 5900. If there's a need to switch to port 5901 due to any issues, remember to adjust the firewall settings accordingly.