Monday, January 24, 2011

Setting up Debian with VNC

For this example I am using tightvncserver:

1. Install tightvncserver
sudo aptitude install tightvncserver
2. Start a vnc session:
>$ vncserver :1
   b. Try to connect to the server
      i. using screen share type in 10.1.10.10:590?
      ii. Enter your password
3. Stop the server:
   a. >$ vncserver -kill :1
4. Edit the config file in ~/.vnc/xstartup to have it look like the following:
>$ vim ~/.vnc/xstartup

#!/bin/sh

xrdb $HOME/.Xresources
xsetroot -solid grey
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
gnome-session &
# Fix to make GNOME work
#export XKL_XMODMAP_DISABLE=1
#/etc/X11/Xsession

5. Edit vncserver and make the following change:
>$ sudo vim /etc/alternatives/vncserver

44 #$geometry = "1024x768";
45 $geometry = "1344x840";
46 $depth = 24;
6. Create/Edit the following file:
>$ sudo vim /etc/init.d/vncserver

#! /bin/sh -e
### BEGIN INIT INFO
# Provides:     vncserver
# Required-Start:   $local_fs
# Required-Stop:    
# Should-Start:     vncserver
# Should-Stop:      vncserver
# Default-Start:    2 3 4 5
# Default-Stop:     0 1 6
# Short-Description:    Start vncserver.
### END INIT INFO

# Some things that run always
touch /var/lock/vncserver

# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting script vncserver "
su - test -c "vncserver :1"
;;
stop)
echo "Stopping script vncserver"
su - test -c "vncserver -kill :1"
;;
*)
echo "Usage: /etc/init.d/vncserver {start|stop}"
exit 1
;;
esac

exit 0
   a. Change "test" to your username
7. Change the permissions:
>$ sudo chmod 755 /etc/init.d/vncserver
8. Set the script to start at boot:
>$ sudo update-rc.d vncserver defaults

No comments:

Post a Comment