How to Install VNC on Ubuntu 18.04 Bionic Beaver

In this article, we will have explained the necessary steps to install and configure VNC on Ubuntu 18.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Virtual Network Computing (VNC) is a graphical desktop sharing system that allows you to use your keyboard and mouse to remotely control another computer.

Install VNC on Ubuntu

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

Step 2. Install Desktop Environment.

Now install Xfce4 and VNC server. Press y and ENTER if prompted to install:

Step 3. Configure VNC Server.

Now that the VNC server is installed the next step is to run the vncserver command which will create the initial configuration and set up the password. Do not use sudo when running the following command:

You will be asked to enter a password. Generate a password 8 chars long, any longer and it will be truncated. You will also be asked if you want a view-only password where the user can only view and not control the remote server. You can skip this if you don’t require it.

VNC Server should now be running:

We now need to edit the xstartup file. Before doing so, kill VNC service:

Back up xstartup file:

Edit xstartup file:

Add the following to the bottom of the file:

Now make the xstartup file executable:

Now start vncserver again:

Step 4. Connecting to CentOS Desktop via VNC Client.

In this example we’ll be using TigerVNC. Open your VNC viewer, enter localhost:5901 and click on the Connect button.

Install VNC on Ubuntu 18.04

That’s all you need to do to install VNC on Ubuntu 18.04. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.