This guide will show you how to compile and run Evlan on a unix system, starting with the source code distribution. Familiarity with unix shells is assumed. This guide was written for Evlan v0.3.3, but the same instructions probably apply to future versions by simply substituting the correct version number.
Before we start, allow me to explain briefly how Evlan operates. Evlan is designed to run as a background process, with only one copy of the virtual machine running on a particular system. You then connect to this process via the Evlan command client in order to issue commands. If you are only trying to play around with Evlan, this probably sounds over-complicated, but for people running Evlan servers (like me), it is very useful.
FreeBSD users: The standard C++ <cmath> header included with FreeBSD 5.3 is broken. You must patch this bug (no need to recompile GCC) before compiling Evlan. Otherwise, Evlan will segfault on startup.
First, unpack the archive:
tar zxvf evlan-0.3.3.tgz
In order to compile Evlan, you first need to build Kake, a C++ build tool which replaces Make. Do so as follows:
cd evlan-0.3.3/kake-0.1.2 ./configure ./build.sh
To install Kake, do the following as root:
cp bin/kake /usr/bin cp -r include/kake /usr/include
Alternatively, if you don't have root access, you can place the kake executable somewhere in your $PATH and copy the kake include directory into the evlan-vm source tree. For example:
cp bin/kake ~/bin cp -r include/kake ../evlan-vm-0.3.3/src
Now we can build the Evlan compiler and virtual machine:
cd ../evlan-vm-0.3.3 kake
At this point you may want to edit the Evlan config file to configure things like whether or not to accept remote connections and what your password should be. Take your favorite text editor to the file:
share/evlan/modules/evlan.org/internal/Config.evlan
Read the comments and edit the fields as appropriate. This may be a good time to read up on setting up SSL.
You can run Evlan from where it is, or you can install it. The only important thing is to keep Evlan's share/evlan directory in the same location relative to bin/evlan. For example, as root you could do:
cp bin/evlan /usr/bin cp -r share/evlan /usr/share
Next you must decide where you want to keep your Evlan state files. I keep them in /var/evlan. If you want to put them elsewhere, substitute your desired location in the following examples.
To start Evlan with an empty state, do:
evlan --create --statedir /var/evlan
The VM is now running. You can now use the Evlan client to connect to the VM and issue commands (see setting up the command client). While connected, issue the following command to save the state:
/do system.service.saveState()
This will save the current state of the virtual machine to the state directory.
To stop the VM, just kill it (using ctrl-C or otherwise). To restore from your saved state in the future, run evlan as before but without the --create flag.
Running as a Daemon
If you would like to run Evlan as a daemon, start by installing daemontools.
Before doing the following, make sure you have created an initial state in the directory /var/evlan for Evlan to load. (If you want to use a different directory, substitute it below.) This means you must run evlan once with the --create parameter, as above, and you must connect to the VM and issue the saveState() command at least once.
With that done, su to root and do:
mkdir /etc/evlan cd /etc/evlan cat > run << __EOF__ #!/bin/sh exec 2>&1 exec evlan --statedir /var/evlan __EOF__ mkdir log cd log cat > run << __EOF__ #!/bin/sh exec multilog ./main __EOF__ ln -s /etc/evlan /service sleep 5 svstat /service/evlan
The last command should report that Evlan is running. On reboot, daemontools will start Evlan again. Read the daemontools documentation for more information on how to control services running under it.
Please note that the above sample configuration runs evlan and multilog as root. For increased security, you may want to run them as users. daemontools has mechanisms for doing this. Read the daemontools documentation for more information.