wave
Uncategorized

How To Setup VNC For Ubuntu.

Mohammed Naser

Mohammed Naser

In computing, Virtual Network Computing (VNC) is a graphical desktop sharing system which transmits the keyboard and mouse events from one computer to another, relaying the graphical screen updates back in the other direction, over a network. In simpler terms, it allows you to remotely access a remote server screen on your own (similar to Microsoft Remote Desktop).

This tutorial assumes that you have some basic VNC knowledge and that you have an Ubuntu server running with SSH access. You will also need to have a VNC client installed on your server, we recommend TigerVNC.

Install GNOME & VNC

GNOME is an open-source project which is developed by volunteers and paid contributors. It provides the graphics user interface (GUI) of many of the Linux operating systems, including Ubuntu, RedHat & CentOS. Once we make sure that our repositories is up-to-date, we’ll start installing GNOME using apt-get.

# apt-get update
# apt-get install gnome-core gnome-session-fallback

This installation is going to take quite sometime as it may download up to 1 gigabyte of packages and install them on your machine. Once this process is done, you can move on the installation of the VNC server:

# apt-get install vnc4server

Configure VNC

The first and most important thing you’ll need to setup is your VNC password. It’s important to have a secure password for your VNC because if someone guesses it, they can access your desktop. You can setup your VNC password by running the following command:

# vncpasswd

We’ve put up a pre-made ready to use .vnc/xstartup as a Gist on GitHub so you can use that existing file right away. You can download it using the following steps:

# wget https://gist.github.com/mnaser/8311130/raw/a31b910b5de71c439bb757585733314ee3c7ef15/xstartup -O ~/.vnc/xstartup
# chmod 755 ~/.vnc/xstartup

Start VNC server

The next step is pretty straight-forward, all we need to do is start the VNC server. You can change the resolution or the colour depth to reduce bandwidth if that is something you need. You can do this by running the following command:

# vncserver -geometry 1024x768 -depth 24 :0

You should now be able to start TigerVNC, put in the IP address of your server in the VNC server field and hit connect. It will request for the password, make sure to enter the password you setup earlier there. From there, you will be connected to your desktop. It should look something like the following:

 

Now, the only small thing left is to make sure that the VNC server start automatically so that if you reboot your server, you don’t have to login and start it again. We can leverage the rc.local file which runs on system boot-up to do this.

# cat "/usr/bin/vncserver -geometry 1024x768 -depth 24 :0" >> /etc/rc.local

Once you’ve done that, you can confirm that it starts up automatically by trying to restart your machine and you should be able to access VNC with no problems at all. With VNC, you’ll easily be able to have full GUI access and use your Linux server without dealing with a harder to use command line interface.

Would you like to know about Zuul, a CI/CD project gating tool? Download our white paper and get reading!

How to up your DevOps game with Project Gating

Share on Social Media:

OpenStack

Cluster API driver for OpenStack Magnum

Mohammed Naser

Public Cloud

9000 MTUs (jumbo frames) in all Public Cloud Regions

Mohammed Naser

Uncategorized

OpenInfra Summit Berlin 2022 VEXXHOST Recap

Mohammed Naser

Go to Top