How to install ubuntu-desktop and vnc?

June 5, 2015 27.3k views
Getting Started Linux Basics Linux Commands Configuration Management

I want to install ubuntu-desktop gui to my server and connect it to via vnc. I read a lot of articles but I couldn't make any success. I installed apt-get install ubuntu-desktop and thinvncserver but when i connect only thing i see is a grey screen. I don't know how to deal with this and idk how to use "nano" to edit files.

  • ubuntu desktop is a little heavy for vnc (and slow)

    I recommend this:

    sudo apt-get install gnome-panel vnc4server

    then, sftp into your home-directory, and find your .vnc directory. Inside there you will find a file named xstartup.
    Edit it with the following:

    # Uncomment the following two lines for normal desktop:
    # exec /etc/X11/xinit/xinitrc
    [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
    [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
    xsetroot -solid grey
    vncconfig -iconic &
    #x-terminal-emulator -geometry 1280x930 -ls -title "$VNCDESKTOP Desktop" &
    x-window-manager &
    gnome-session --session=ubuntu -geometry 1280x930 -ls -title "$VNCDESKTOP Desktop" &
    gnome-panel &
    nautilus &
    gnome-settings-daemon &

    save. reboot.

    start a vnc session with this (you can set the screen-size to whatever you want to fit your monitors better):

    vncserver -geometry 1280x930

    now login with your vnc client...it takes a minute for everything to load, but you should have a classic gnome interface that is much snappier than ubuntu desktop

  • VNC is a connection system that allows you to manage your Ubuntu server with a graphical desktop environment. With VNC, you can use your keyboard and mouse to interact with a graphical display of your remote server, making it easier to work with the server.
  • @hunky well i don't want that tutorial because it uses xfce and i don't want xface

  • @sierracircle Thank's but I couldn't find anything in /home directory. Am I looking at the wrong dir?

  • should be in your users home directory. So if your username is fattur, it would be /home/fattur/.vnc

  • home directory is completely empty. there are no folders at all even tho I created new user. then again i created a new user. There are 3 files

    that's all

  • have you installed vnc4server?

    also, try running vnc4server once..it might create the folder. log in as your user and:

  • yeah i started vncserver and files were there but it gave an error at first time i connected and it doesn't looks good i must say. Here are the pictures:

  • when you start vnc, and when you log in, are you using your root account? or are you using a different user?

  • I'm using root account and I make the changes on root account

  • I logged in with another user and i made the file edits but result is the same:

  • you need to kill your vncserver and start as your user:

    sudo kill vncserver :1

    then restart(logged in as a regular user:

    vncserver -geometry
  • @sierracircle thank's. Could you look at my answer below? I've done it by those steps. I want to learn your thoughts about it :D Thank's a lot. Really. Only problem is I can't access the System Settings under System Tools. I didn't checked a lot of things but that was the first thing i noticed.

3 Answers

Okey I think I've done it by these steps. Thank's a lot to @sierracircle .

create new user by writing these:
(vnc is username. you can choose whatever you want)

adduser vnc

enter a password


then login as new user

then write su and get root access
then install those packges

sudo apt-get update
sudo apt-get install gnome-shell && ubuntu-gnome-desktop && ubuntu-core -y
sudo apt-get install vnc4server -y

after installed these exit and be back to vnc(get rid of root rights)
start vnc server by writing


it should be asked for a password. Define a password. You will use it to connect your server.

go to ftp manager and connect to your files
find this file and make the changes that told at below


comment out these by #

#start on ((filesystem
#           and runlevel [!06]
#           and started dbus
#           and plymouth-ready)  
#     or runlevel PREVLEVEL=S)

this will prevent gnome from starting at your console

then again in file manager goto your home direction and find the folder of the newly created user. in my case it was:
in that folder you must see a folder as ".vnc" inside of that there is a file named "xstartup" .
Exact path is :


Edit it with the following changes:


# Uncomment the following two lines for normal desktop:
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &

#gnome-session --session=ubuntu -geometry 1024x768 -ls -title "$VNCDESKTOP Desktop" &

metacity &
gnome-settings-daemon &
gnome-panel &

save the file and reboot your droplet
then login with newly created user (vnc) and start vncserver again with


command. then connect to it by a vnc program. To address write your droplets ip and add vnc port. It should be like
and login with your vnc password. That's all. Happy end :)


Edit: Oh there is a little problem which is System Settings under System Tools is inaccessible

@Fattur Actually, I need to seperately install sudo apt-get install ubuntu-gnome-desktop

And install this: sudo apt-get install gnome-core

Have another answer? Share your knowledge.