Wednesday, February 2, 2011

Running vnc on centos 5

I helped a friend set up vnc on centos 5 today. Here's how we did it.

Wrote a shell script to start the vncserver daemon

#!/bin/sh


unset DBUS_SESSION_BUS_ADDRESS
vncserver -geometry 1000x1000 :1


I needed the unset part on Ubuntu, not sure it's needed on Centos5.

Create a password:

% cd ~/.vnc
% vncpasswd


Edit xstartup

#!/bin/sh

unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &


the last line tells vnc to start the gnome desktop.

Connect with RealVnc, using hostname:5901