Setup an X11 Desktop on a TonidoPlug and Connect via VNC

This guide will show you how to install the X11 desktop and VNC server on your TonidoPlug and how to connect to it from a VNC desktop client.

As always, X11, VNC server and all non-Tonido software should only be installed on plugs which are booting from USB or SATA drives.


Install X11 and VNC

1. SSH into the plug.

2. Install X-windows, VNC and the Ice themes.

 apt-get update
 apt-get upgrade
 apt-get install x11-common x11-apps x11-utils xbase-clients vnc-server icewm icewm-gnome icewm-themes

3. Start VNC server:

 vncserver

4. Test X-windows from SSH on a Linux computer.

 sudo ssh –X <plug_IP>
 xeyes

 You should see “eyes” on your Linux desktop.


Setup the VNC Server to Autostart at Boot

These steps will start the VNC server at boot so it will always be available for connections. This part is optional.

5. Create the startup script, make it executable, and open it for editing.

 touch /etc/init.d/vncserver
 chmod +x /etc/init.d/vncserver
 nano /etc/init.d/vncserver

6. Edit the script and paste in the following.

#!/bin/sh -e
### BEGIN INIT INFO
# Provides:          vncserver
# Required-Start:    networking
# Required-Stop:     networking
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
### END INIT INFO

PATH="$PATH:/usr/X11R6/bin/"
 
# The Username:Group that will run VNC
export USER="root"
#${RUNAS}

# The display that VNC will use
DISPLAY="1"

# Color depth (between 8 and 32)
DEPTH="16"

# The Desktop geometry to use.
#GEOMETRY="<WIDTH>x<HEIGHT>"
#GEOMETRY="800x600"
GEOMETRY="1024x768"
#GEOMETRY="1280x1024"

# The name that the VNC Desktop will have.
NAME="your-vnc-server"

OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"

. /lib/lsb/init-functions

case "$1" in
start)
log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
;;

stop)
log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
;;

restart)
$0 stop
$0 start
;;
esac

exit 0

7. A few key settings:

 GEOMETRY="1024x768"    - determines the resolution of the virtual desktop. Lower resolutions will be more responsive.
 export USER="root"     - you can run VNC server under another user.
 NAME="your-vnc-server" - you can change the name of your VNC server here.  

8. Save the script and exit nano.

 CTRL-o
 CTRL-x  

9. Set the script to run at startup.

 update-rc.d vncserver defaults 99

10. Run it for the first time.

 /etc/init.d/vncserver start


Connect Via VNC

11. Connect to you plug using a VNC client. Note: the VNC port is 5901.

 <plug_IP_address>:5901
  
 From linux, with Tight VNC installed:
 xtightvncviewer <SheevaPlugsIP>:5901



Sources: http://www.tonido.com/forum/viewtopic.php?f=14&t=2736&p=13758&hilit=x11#p13758, http://computingplugs.com/index.php/Installing_X11, http://www.abdevelopment.ca/blog/start-vnc-server-ubuntu-boot