Install VNC server on Ubuntu Server

Hi all

sometimes VNC is really useful when you want to access the remote server. Though every thing can be done via command prompt but sometimes a GUI is useful (Atleast I find it useful).

Now if you want to do that here are the steps you need to follow. As you know that most or all servers dont come with Gnome installed. So thats the first step you need to do

Start with the following command

sudo apt-get update

Than install the Gnome-Core components using

sudo apt-get install gnome-core

Now install a virtual desktop using

sudo apt-get install vnc4server

Now setup a password to login using the following command. It will prompt to setup a password and verify it


Than run the vnc server using

vncserver :1

Now before you proceed kill it once using

vncserver -kill :1

Now open the config file from .vnc/xstartup or ~/.vnc/xstartup

using nano .vnc/xstartup (I perfer nano you may use vim or vi)

Than uncomment the line which says


And add sh to the line below it like this

exec sh /etc/X11/xinit/xinitrc

Exit the file and run the command as below

vncserver :1 -depth 16 -geometry 1028×1024

Than download tightVNC from

connect using ip:1 (:1 is for the vnc server window)

You might see a dialog box with error and a delete option. Click delete and done 🙂

You now have GUI access to your server.

You may want to install synaptic using

apt-get install synaptic

Thats all.. Hope this article helps. If you get stuck do write to me.

Be Sociable, Share!


  • Kanth

    I just bought a VPS and i am a total linux noobie, i barely know any linux

    i tried other tuts but all failed on me .. Nobody mentioned about installing gnome-core. and i kept failing while installing vnc4server.

    Your Tutorial is just kickass , and iam now into my server 😀

    P.S. you the following
    “And add sh to the line below it like this
    exec sh /etc/X11/xinit/xinitrc”

    Should i also uncomment the line “# exec /etc/X11/xinit/xinitrc” after adding sh to it ?


  • Hi Kanth there is no need to uncomment the line # exec /etc/X11/xinit/xinitrc

  • Josh Earl

    I’m working on setting up a Linode VPS using these instructions, and everything appears to be fine until I try to log in with the VNC client. I’m getting a message “ubuntu session failed to load” and the dreaded gray screen with the black X. Any suggestions?

  • Hi Josh if you can try to reinstall gnome. Looks to me as a Gnome issue. Also try to disconnect vnc and restart the #1 instance.

    Also while googling if found these

    sudo apt-get install ppa-purge
    sudo ppa-purge ppa:gnome3-team/gnome3

    Try and let me know.


Leave a Reply

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