Install VNC Server on Ubuntu 20.04 - Best Method ?

Virtual Network Computing (VNC) is a visual screen-sharing solution that lets you operate another device remotely using your touchpad. It is a fair and democratic replacement to Microsoft's RDP (remote access protocol). TigerVNC, TightVNC, Vino, vnc4server, and far more applications are existing to remotely control Linux-based desktops. TigerVNC is a high-performance VNC server that may be used to remotely manage or view Linux-based desktops. It is fair and democratic. It is indeed a client/server program that lets you communicate with graphical programs on other computers.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related VNC queries on Linux Systems.

In this context, we shall look into how to install and configure the TigerVNC server on your Ubuntu 20.04.


How to Install VNC Server on Ubuntu ?

Before performing this Installation procedure, follow the steps outlined below.


1. Update Ubuntu 20.04 system

To get started with VNC Server, we need to first update our system and apt package. Open the terminal suing Ctrl+Alt+T, and execute the below command in it for the update:

$ sudo apt update && sudo apt upgrade

It requires a sudo password to execute. Add root account password and tap Enter. It takes a little while to get completed.


2. Configure Desktop Environment

Let's start by installing a Desktop Environment on our Linux platform, which isn't included by default. There are several options, including GNOME, MATE, XFCE, and others. In this lesson, we'll use the XFCE desktop environment. It is indeed a minimalistic desktop environment that aids in maintaining a reliable and seamless VNC connection. 

Try the stated command:

$ sudo apt install xfce4 xfce4-goodies

Tap "y" to affirm the process of installation. Otherwise, press "n" to stop it.

Select Package configuration and hit the OK button.


3. Install TightVNC Server

Configure the TightVNC server modules after finishing the XFCE workspace deployment. Additional prominent VNC servers include TigerVNC as well as x11vnc. Use the apt query to install the packages listed underneath:

$ sudo apt install tightvncserver

Add the sudo password to continue the process.


How to Launch VNC Server ?

To enable or launch the VNC server we need a very simple below command to be executed in the shell as follows:

$ vncserver

As we haven't given any password to our server, hence we need to the add-up password for our server. In this case, add the below password command in the shell to do so:

$ vncpasswd

It will ask you to enter the password and verify it by adding it again. After that, it will ask you if you want to add some view-only passwords. Press "Y" to affirm, otherwise hit "n" to quit. You can see, as we have added "Y". Hence it asked for the password. Enter the password and then verify it by adding it again.


How to Configure VNC Server ?

Upon starting the server, it created a configuration file. It's important to set up the VNC server to begin at the same time as the Ubuntu server. Furthermore, you must specify which User Interface the VNC server would join. Let's start by terminating the existing VNC server instance at TCP port 5901:

$ vncserver –kill :1

Now we need to create a backup of a configuration file i.e. xstartup. Hence try out the below "cp" query in the shell for backup:

$ cp ~/.vnc/xstartup ~/.vnc/xstartup.bak

Now open the configuration file by any of your favorite editors. We have been using the GNU nano editor in our case to open it as below:

$ nano ~/.vnc/xstartup 

Now the file has been opened, update it with the below-presented code in the image. Save the file with Ctrl+S, and quit it via the Ctrl+X shortcut.

Restart your VNC Server once again using the query below:

$ vncserver -localhost


How to Connect Server ?

The last but most important part is to connect with the server. Make sure you have the "SSH" package installed. Let's first check the local servers:

$ ss -ltn

Navigate towards the system folder via the below "cd" command. After that, use any of the editor to create and open the vncserver@.service file:

$ cd /etc/system/system
$ vim vncserver@.service

Update the file with the below code and quit.

Now add the below command to connect with the SSH tunnel locally. You can see that the process is successful after adding answers to some affirmations.


[Need help in setting up VNC on Debian Linux System ? We can help you. ]

This article covers how to install and configure VNC Server on Ubuntu 20.04. Virtual Network Computing, or VNC, is a connection system that allows you to use your keyboard and mouse to interact with a graphical desktop environment on a remote server. It makes managing files, software, and settings on a remote server easier for users who are not yet comfortable with the command line.

After connecting to your server with SSH, update your list of packages:

$ sudo apt update

Now install Xfce along with the xfce4-goodies package, which contains a few enhancements for the desktop environment:

$ sudo apt install xfce4 xfce4-goodies

Once that installation completes, install the TightVNC server:

$ sudo apt install tightvncserver

Related Posts