Casbay Knowledge Base

Search our articles or browse by category below

4 Steps To Install VNC Server On Linux VPS Server For Ubuntu OS

Last modified: September 30, 2022
Estimated reading time: 2 min

What is VNC? VNC is the short version for Virtual Network Computing. VNC desktop sharing access, which allows users access to another machine with their machine.

To control or use a desktop environment that is installed in your Ubuntu VPS, a VNC server is needed. Here is how you can set up and configure a VNC server on your Linux VPS server, followed by connecting it through the VNC client.

Step 1: Pick A VNC Server

For a Ubuntu VPS, there are multiple VNC servers for users to pick from. While there are multiple VNC servers for users to pick from, for this guide, we will only be using TigerVNC. TigerVNC is a VNC server that provides high-performance and client applications that support most kinds of operating systems such as Linux, Windows, and macOS.

Step 2: Installation

To install the Tiger VNC server onto your Ubuntu VPS, type in the following command.

sudo apt-get install tigervnc-standalone-server

Due to unpacking multiple packages and installing them, it will take some time before the installation is complete. Please wait patiently until the installation is completed and ended.

Step 3: Setting Up Password

After the installation is completed, type in the following command to pick a password to access your VPS.

vncserver

By default, TigerVNC will also ask the user if they would like to set a password for viewing only or not, then verify the password set. To change the VNC password whenever you want, use the following command below.

vncpassword

Step 4: Configure Startup File

However, even after setting up the password for TigerVNC, the issue that comes after that is that the TigerVNC still needs to be configured every single time a client connects to it, which could be troublesome.

In this section, we will configure the startup file to remove this issue. To configure it, first, we will need to stop all processes by TigerVNC. Use the following command to stop all the processes of TigerVNC.

vncserver -kill :1

Secondly, we will need to make a backup file before configuring the files in case any issues appear. The file that we need to backup is “~/.vnc/xstartup”. The command to back up is as followed.

mv ~/.vnc/xstartup ~/.vnc/xstartup-backup

Finally, open the “xstartup” file with any text editor of your preference, and replace them with the following lines.

#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &

Save changes and exit the text editor and your startup file should be configured nicely. To test it, restart the VNC server, and log into the VPS as a client user. If any issues pop up, use the backup files and re-configure again.

Was this article helpful?
Dislike 0
Previous: Linux VPS Server Guide On Desktop Environment Installation For Ubuntu in 4 Steps
Next: 3 Basics of Using MongoDB In Linux Based VPS