Install VNC server on Ubuntu 13.04

First install vncserver

sudo apt-get install vnc4server

And then create one vnc display

vncserver

The output will show the display number, in this case :1

New 'hostname:1 (username)' desktop is pc-hostname:1

I chose gnome fallback to be my vnc desktop environment, and so I install

sudo apt-get install gnome-session-fallback

And edit the file ~/.vnc/xstartup to be like this

1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
gnome-session-fallback &

[ -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 &

Now you can connect to this vnc display using any vnc client, considering the fact that the display :1 is equivalent to tcp port 5901, and so on…

Finally to stop the vnc display run

vncserver -kill :1

Comments