Using VNC on Azure Linux VMs

Are you a MAC or Windows User? A big fan of GUI? Tired of SSH’ing to Linux VMs? What if you want to browse the web? VNC comes to the rescue.

The following article was written for Ubuntu VM but a similar process applies to other Linux flavors as well.

1. Create a new Azure VM

Provision a Linux Virtual Machine from Azure Portal or Azure CLI.

2. Connect to the VM

ssh azureuser@public-ip

3. Install packages

Once connected let’s update our sources list and install some extra packages:

$ sudo apt-get update
$ sudo apt-get install tightvncserver

4. Install the desktop environment

Before configuring the VNC server we shoud install one of the favorite desktop environments like Gnome or Xfce . I personally like Gnome. It’s beautiful … and heavy! So be patient while everything gets installed..

5. Setting up VNC Server

Now that our instance has a desktop environment let’s make it accessible via VNC. Start the vncserver, and follow the directions to create a password

$ vncserver
Note: this password will grant access to your instance, so make sure you remember this password.

If everything went fine your VNC server is now running and listening on port 5901. You can verify this with netcat from the Azure Ubuntu VM:

$ nc localhost 5901
RFB 003.008

6. Installing a VNC Client

You can google search for a VNC client. My favorite one is RealVNC Viewer

Install the VNC Client but don’t try to connect to your server just yet: it will fail as the firewall rules don’t allow it.

7. Open the firewall

Go to your VM’s Network Security Group and allow traffic on port 5901

8. Connecting to the VNC server

From your local desktop, launch VNC Client

Open a terminal window in the linux vm.

Install your favorite browser

sudo apt-get install firefox

Launch the browser

And voilà! You can now use your favorite Desktop environment on your Azure VM instance.


The VNC tool provides a rich desktop experience, packed with features that will make you more productive. This is especially useful for native Windows or MAC users. Go ahead and give it a try!!

Leave a Reply

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