Thursday, February 8, 2007

VNC Setup on linux

2 Ways to do that:
===============================
1) Easier way is to edit:

/.vnc/xstartup

Comment all existing lines in the file and ADD

# Red Hat Linux VNC session startup script
exec /etc/X11/xinit/xinitrc

Your /etc/X11/xinit/xinitrc should look like this:

$$$$$$$$$$$$$$$$$$$$$$$$$$$
#!/bin/sh
# Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This
# copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the
# GNU General Public License version 2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# Mandatorily source xinitrc-common, which is common code shared between the
# Xsession and xinitrc scripts which has been factored out to avoid duplication
. /etc/X11/xinit/xinitrc-common

# The user may have their own clients they want to run. If they don't,
# fall back to system defaults.
if [ -f $HOME/.Xclients ]; then
exec $DBUS_LAUNCH $HOME/.Xclients || \
exec $HOME/.Xclients
elif [ -f /etc/X11/xinit/Xclients ]; then
exec $DBUS_LAUNCH /etc/X11/xinit/Xclients || \
exec /etc/X11/xinit/Xclients
else
# failsafe settings. Although we should never get here
# (we provide fallbacks in Xclients as well) it can't hurt.
xclock -geometry 100x100-5+5 &
xterm -geometry 80x50-50+150 &

if [ -x /usr/X11R6/bin/twm ]; then
exec /usr/X11R6/bin/twm
fi
fi
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

================================
2) VNC Setup on linux
cat cd ~/.vnc/xstartup

#!/bin/sh

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

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

Start the vncserver with the following ,

vncserver -depth 16 -geometry 800x600

Create an alias in $HOME/.bash_profile

alias startvnc='vncserver -depth 16 -geometry 800x600'