How to Install a VNC Server on Linux

How to install VNC server on Linux Mint 18.3

A few days ago, I was browsing for some wedding gifts at because my brother is getting married again (for the second time!). However, that is not the issue here, the other day he was asking me about setting up a VNC server on Linux.

It shocked me a little as I always thought it’s quite easy to set that up. However, it motivated me to create this short guide, so have fun!

Installing a VNC Server on Linux

A VNC server is indeed a handy tool to have in today’s world. Whether you are an individual that likes having access to your desktop at all times or whether you are a firm that needs this kind of access in situations that require fixing or troubleshooting, then VNC is the thing for you.

VNC or virtual network computing allows you to access a particular desktop by any device or desktop where the VNC is installed. Now coming to the installation of a VNC server, you may have come across articles that guide you on how to install a VNC network on Windows.

However, since Linux is a comparatively lesser-used operating system, there is barely any guidance on how to install a VNC server on Linux.

Installing a VNC on Linux is easy and takes very little time. Here are a few things you should need to install before VNC on your computer with a Linux operating system.

  • Ubuntu Server version 18.04
  • VNC Client
  • Sudo privileges for a user

How to Install on Desktop

It would help if you had a good desktop on your Ubuntu server. You will have to install the efficient Xfce desktop. For this, you have to log into Ubuntu Server and use the command:
sudo apt-get install xfce4 xfce4-goodies –y.

installing vnc server on linux

How to Install the VNC Server

There are many affordable and value for money VNC servers like VNC Viewer Plus, Tight VNC Viewer, Tiger VNC, Ultra VNC, and SmartCode Web VNC Viewer. Selecting the best VNC server for your computer is essential as the functionality and efficiency of Virtual network computing is almost entirely dependent on the efficiency of the application.

Here we will be considering TIGHT VNC to site an example. TIGHT VNC is one of the most efficient and easily installable VNC apps there is. To install this VNC software, open the terminal which you want to access remotely and enter the command: sudo apt-get install tightvncserver -y.

Once, the installation is complete; you need to use the following command: vncserver.

After this, you will be led to the VNC configuration. This page will prompt you to create new, unique passwords that only you can access. You can use this password to log into your terminal from any device. VNC passwords should usually be eight digits.

Make sure you form your password in a way that is a bit complicated and yet easy to remember. Sadly we live in a generation where identity theft and other mishaps on the internet is not unheard of. To make sure that none of your private information is tampered with, a strong password is a must.

Once you have set the login and password for access, you will have to kill the server with the command: vncserver -kill :1.

Configure the VNC Server

You will have to create a configuration file before restarting your server. Use this command: nano ~/.vnc/xstartup.

After entering this command, another file will open in which you have to write the following commands:

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

After putting the above contents, make sure you save and then close the file.

After you have successfully saved the file, change the permissions of execution with the following command: sudo chmod +x ~/.vnc/xstartup

Now that you have changed the execution permissions, the time has come to restart the VNC server. Restart the VNC server by putting in the command: vncserver

How to Connect to the Server

We will have to use tunneling to connect to the remote server. For example, if we use the SSH tunneling to connect to create a tunnel on the remote Linux desktop, we will have to put in the command: ssh -L 5901: -C -N -l USER SERVER_IP.

Where USER is the username for starting and configuring the VNC server, and SERVER_IP is the remote server’s IP address. You will be subsequently prompted to enter the remote user’s password. Once it is authenticated, the secure tunnel is fully functional.

After your work is done, make sure you kill the command, and so the tunnel is shut down. And if you want to connect to the remote server again, you will have to create an SSH tunnel once more.

The above are a few steps you may follow when you are unsure of how to install a VNC server on Linux.

Leave a Reply

Your email address will not be published. Required fields are marked *