We’ve switched to a new Server machine after we had some serious trouble with our NAS device. This new one is an Atom-based machine with a disk array for mirroring data (RAID 1). It is used as a file server, database server and as a library server for VA Smalltalk. We’ve decided to go with a console-only OpenSuSE 11.2 64 bit, since there is no need for a GUI on a machine that’s sitting in a corner and only serving data. We have better use for the CPU cycles 😉

This, however, brings us to a little problem: the VA Smalltalk library manager install process needs X-Windows, which is nice but not necessary for our purposes. In our case, it’s even bad, since we cannot run the setup program. Fortunately, there is not much that’s really needed for a Linux-based library manager: just the emsrv program to handle client connections and the library (mgr80.dat) file. We don’t password protect our library, so the setup is really simple. I even did it remotely through an SSH client from my Mac.

Manual installation of emsrv and the manager file

The first step (after downloading VA Smalltalk, of course) ist to unzip the va801_ml.zip in some temporary directory.

Then simply copy the emsrv executable from
$YourTempPath/cd_m/manager/base-manager/linux/bin
to a directory in either the /var or /usr path. We chose to install at
/usr/local/VASmalltalk/8.0

We now need a manager library. You can either copy an existing one onto the server (which is what we did since we have a lot of existing code), or you can use the one shipping with the installation zip mentioned above. You’ll find the file in you unzipped directory at $YourTempPath/cd_m/manager/manager/mgr80.dat

We’ve put it on some path that’s on our RAID, since that’s a device that’s backed up regularly, but you can chose to put it in the same directory as the emsrv program.

Before a client can use the library manager you have to make sure that the server’s firewall has the emsrv port opened. By default, emsrv uses port 4800. It’s easy to open a port on the firewall by using YaST, so I won’t cover it here.

So all you need to do now is start emsrv by cd-ing to  /usr/local/VASmalltalk/8.0 and executing ./emsrv.

You can now start a Smalltalk image on a network client that use the “Reconnect To Server…” menu. You need to specify the IP address of the Linux Server and the local path of the Library. Keep in mind that the path must be the one local to the server, the directory with the library in it does not have to be accessible to the client. Just browse some code or load from the library to see whether this is okay.

How to make it start on Server Boot?

In order to have the manager available automatically after each server boot, you need to write an init-V script that starts emsrv when the runlevel 3 and/or 5 is entered. It sounds complicated, but is really easy, once you’ve found a place to learn from…

Create an init-V startup Script in /etc/init.d with the following contents:

#!/bin/sh
#
### BEGIN INIT INFO
# Provides:          emsrv
# Required-Start:    $local_fs $network $syslog
# Should-Start:      $time
# Required-Stop:
# Should-Stop:
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: EMSRV VA Smalltalk Library Manager
# Description:       Start emsrv, the VA Smalltalk Library Manager process.
### END INIT INFO
# The following line might be different for your installation
EMSRV_BIN=/usr/local/VASmalltalk/8.0/emsrv
# Check for missing binaries (stale symlinks should not happen)
test -x $EMSRV_BIN || { echo "$EMSRV_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
. /etc/rc.status rc_reset

case "$1" in
start)
echo -n "Starting EMSRV "
## Start daemon with startproc(8). If this fails
## the return value is set appropriately by startproc.
/sbin/startproc $EMSRV_BIN

# Remember status and be verbose
rc_status -v
;;
stop)
echo -n "Shutting down EMSRV "
## Stop daemon with killproc(8) and if this fails
## killproc sets the return value according to LSB.

/sbin/killproc -TERM $EMSRV_BIN

# Remember status and be verbose
rc_status -v
;;

restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start

# Remember status and be quiet
rc_status
;;

*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
exit 1
;;
esac
rc_exit

and finally use the insserv utility to make symbolic links in /etc/init.d/rc3.d and /etc/init.d/rc5.d (if you use X-Windows)

insserv emsrv

After the next reboot of the server (or a switch between runlevels using the init command), the library manager can be accessed from any (windows or Linux or AIX or whatever) client that can reach the server by TCP/IP. There is no need to do anything on the server since emsrv is now started as part of the startup sequence.

The fine print

Please keep in mind that this way of installing is not necessarily the recommended way of doing it. There even might be some security issues with the fact that emsrv is now running under root privileges. This installation does not support passwords for the library and since we don’t use this mechanism anyway, that’s really fine with us. Enabling password protection is a question of adding command line parameters on startup of emsrv, so this should be an easy exercise.

And, of course, never forget to backup your library regularly!