Logo-small

4.3.5 Remote Development

This how-to section is dedicated to running a remote Pharo image from a Linux server and using Windows platform as a local system. You might need to improvise to adapt it to your own specific scenario.

Remote development using X-server is extremely slow so you might want to consider using VNC client/server approach for remote development with Pharo.

Installing RFB Server in Pharo

While you are still at you Pharo local system (or using a remote connection with X-server) do following steps:

  1. Start your Pharo locally (or remotely via X-server)
  2. Install RFBServer/View. In Workspace copy following and "do it"
Gofer it
squeaksource: 'MetacelloRepository';
package: 'ConfigurationOfRFB';
load.
((Smalltalk at: #ConfigurationOfRFB) project perform: #latestVersion) load.

Configuring the RFB Server

  1. From the World menu select Tools->More->RFB/VNC Server. The menu will stay open till you explicitly close it. Now we'll make a few operations with the menu.
  2. Start the server
  3. Set interactive password (password menu), allow ZRLE encoding (performance menu), un-check "allow remote connections" (connections menu)
  4. Save the image and quit Pharo

Now every time you run your Pharo image, it'll run the RFB server listening for incoming connections on port 5900.

Running Pharo in headless mode

Save following as Pharo-headless.sh script (right in your Pharo root folder) and give it exec permissions:

#!/bin/sh
APP=`dirname $0`
EXE="$APP/Contents/Linux686"
RES="$APP/Contents/Resources"

exec "$EXE/squeak" -plugins "$EXE" 
        -encoding latin1 
        -vm-display-X11 -headless   
        "$RES/Pharo-1.0.image"

This script will enable you to run Pharo from command line without UI. We don't need to connect to X-server now that we have our RFB server inside Pharo.

Establishing a tunneled connection via SSH

Now that your Linux side is pretty much configured, let's go to your Windows client. On Windows, you need to setup the tunneling via ssh to access your remote Pharo image. It serves two purposes, first it make the connection secure and second, you don't have to set up port forwarding on your Linux network (telling the router to forward all connections on 5900 port to go to your linux server).

To set up the tunneling you can use either ssh (with cygwin) or putty, they accept same parameters. I prefer putty since it's a standalone application with a nice GUI. Establish a connection with your remote Linux server using putty (or ssh). At the command line prompt type (you can use ssh with the same command line parameters):

>putty -C -L 5900:localhost:5900 username@your-linux-ip-address-or-domain

With this command we told putty to establish a connection with your remote machine using ssh-2 secure connection, establishing a tunnel between port 5900 on windows system to port 5900 on your localhost. The localhost denotes an ip address of your Linux server on the local network. In my case it's 127.0.0.1, in your case instead of localhost you can supply the local ip address of your Linux server.

Connecting to the remote Pharo with a VNC client viewer

Now that we established a connection with the Linux server, all we need to do is run Pharo in headless mode, and use a VNC client to connect to Pharo. In you currently connected putty (or ssh) window, run the Pharo-headless.sh script since we already created it before.

$./Pharo-headless.sh

Pharo is up and running and RFB server inside Pharo is listening for incoming connections on port 5900. Install and launch any VNC client on your Windows system. I prefer UltraVNC viewer, but I also had good results with TightVNC viewer.

When you start a VNC viewer you'll get to select network connection speed and encoding. For connection speed select "SLOW" (if your network is fast you'll change it later), in connection options select "ZRLE encoding" (remember, we told Pharo's RFB server to support it?). Press "Connect" button and you'll be presented a password dialog. Type in the same password you chose when setting up the RFB server and that's it, you should be connected now with your remote Pharo image!

Add a Note

Licensed under Creative Commons BY-NC-SA | Published using Pier |