From: http://nuclear-imaging.info/site_content/2011/05/11/vnc-server-setup-for-ubuntu-11-04-natty-narwhal/
For the first time I was able to get VNC to work with Ubuntu with Gnome session instead of a xterm on gray background. the steps involved were exactly the same as I was following earlier, with one exception: the setup of xstartup IN ~ /. VNC folder.
For your xstartup file in ~ /. VNC (the ". VNC" folder in
Your home directory), you need the following:
#----------
#! /Bin/sh
# Uncomment the following two lines for normal desktop:
# Unset session_manager
# Exec/etc/X11/xinit/xinitrc
[-X/etc/VNC/xstartup] & exec/etc/VNC/xstartup
[-R $ home/. Xresources] & xrdb $ home/. Xresources
Xsetroot-solid gray
Vncconfig-iconic &
Xterm-geometry 80 × 24 + 10 + 10-ls-title "$ vncdesktop desktop "&
Gnome-session &
# TWM &
#--------
Instead of uncommenting the lines as the script suggests, you change the window manager to gnome-session
Make sure restart vnc4server
The line which got gnome working was "gnome-session &"
==========================================================
Now for all the steps involved (works in karmic koala Alpha 2, UBUNTU 9.10, kernel 2.6.30-10)
1. Install SSH server, SSH client, VNC Viewer, VNC Server, and xinetd
Sudo apt-Get install OpenSSH-server openssh-client vnc4server xinetd vncviewer
2. setup the SSH password for your login
Ssh-keygen
3. test out the SSH server by typing in
SSH localhost or SSH your_login @ your_ip_address
4. then create a VNC Password
Sudo vncpasswd ~ /. Vncpasswd
5. Edit the xstartup file in ~ /. VNC directory
For your xstartup file in ~ /. VNC (the ". VNC" folder in
Your home directory), you need the following:
----------
#! /Bin/sh
# Uncomment the following two lines for normal desktop:
# Unset session_manager
# Exec/etc/X11/xinit/xinitrc
[-X/etc/VNC/xstartup] & exec/etc/VNC/xstartup
[-R $ home/. Xresources] & xrdb $ home/. Xresources
Xsetroot-solid gray
Vncconfig-iconic &
Xterm-geometry 80 × 24 + 10 + 10-ls-title "$ vncdesktop desktop "&
Gnome-session &
# TWM &
--------
Instead of uncommenting the lines as the script suggests, you change the window manager to gnome-session
6. Create a VNC Desktop
Vnc4server: 1-geometry 1024 × 768
7. Then to tunnel into your VNC desktop, first create a SSH tunnel by logging into SSH with the Comand:
Ssh-l 5901: your_ip_address: 5901 your_username @ your_ipaddress
8. Finally, load up your VNC Desktop
Vncviewer localhost: 1