Installing Ellogon HTTP REST Services (Ubuntu)

Although the preferred operating system for running Ellogon services is Fedora, this page provides some instructions on how the needed packages can be installed under Ubuntu. Please follow the following steps to install services and configure your applications.

 

1) Install some needed packages

The graphical package of Tcl (Tk) requires libXft.so.2. If this library is not available, you can install it as:

sudo apt-get install libxft2 libXss1

2) Install ActiveTcl 8.6

Ellogon requires Tcl 8.6, and the binary distribution from ActiveTcl is recommended. ActiveTcl 8.6 (or newer) can be downloaded from: http://www.activestate.com/activetcl/downloads.

You can follow the following commands to download and install ActiveTcl:

cd ~
wget http://downloads.activestate.com/ActiveTcl/releases/8.6.3.1/ActiveTcl8.6.3.1.298624-linux-x86_64-threaded.tar.gz
tar xvfz ActiveTcl8.6.3.1.298624-linux-x86_64-threaded.tar.gz
cd ActiveTcl8.6.3.1.298624-linux-x86_64-threaded
sudo sh install.sh

The last command will start a graphical installer. Please use the default options in all windows. ActiveTcl 8.6 will be installed in /opt/ActiveTcl-8.6.

Then, execute the following command to install the Tcl/Tk library packages, as distributed by ActiveTcl:

sudo /opt/ActiveTcl-8.6/bin/teacup update-self
sudo /opt/ActiveTcl-8.6/bin/teacup update

Please remember to repeat these two command frequently, to keep your library up to date.

The last step, is to add ActiveTcl's library path to the system, so Tcl libs can be found:

Create a new text file named "/etc/ld.so.conf.d/x86_64-ActiveTcl86.conf", and place the following as content:

/opt/ActiveTcl-8.6/lib/

Then, execute the following command:

sudo ldconfig

3) Install Ellogon

You can install Ellogon by using a suitable binary distribution (found here). However, it is easier to install the binary distribution from SourceForge:

cd /opt
sudo mkdir Ellogon
sudo chown -R put-your-username-here:put-your-groupname-here Ellogon
cd /opt
svn checkout svn://svn.code.sf.net/p/ellogon/code/runtime Ellogon

You can verify that Ellogon runs, by issuing the following command:

/opt/ActiveTcl-8.6/bin/wish8.6 /opt/Ellogon/ellogon

In order to keep your Ellogon binary distribution up-to-date, you can use the following commands:

cd /opt/Ellogon
svn update

4) Install Ellogon HTTP Server Support

Ellogon services are provided through the Apache2 Web Server, and the Apache Rivet module. Apache Rivet allows Tcl/Tk scripts to be run inside Apache2, and Ellogon provides a small set of scripts that load Ellogon inside Apache2. In order to install these scripts (i.e. in ~/ellogon-apache-services), execute the following commands:

cd ~
svn checkout svn://svn.code.sf.net/p/ellogon/code/apache-rivet ellogon-apache-services
/opt/ActiveTcl-8.6/bin/tclsh ~/ellogon-apache-services/server/server_init.tcl

5) Install Apache2 (if not installed) and Apache Rivet 2.1 (or newer)

Ellogon services require the Apache2 Web Server, and the Apache Rivet module, enabling the use of Tcl from within Apache. The latest version of Apache Rivet is recommended, and Apache Rivet must be have linked with Tcl/Tk 8.6 (or newer). An Apache Rivet module linked with Tcl/Tk 8.5 (or older) version is not going to work, as Ellogon requires at least Tcl/Tk 8.6.

Apache2 can be installed with the following command:

sudo apt-get install apache2 apache2-mpm-prefork

We need to make sure that Apache2 uses the "prefork" MPM:

cd /etc/apache2/mods-enabled
sudo rm -f mpm_event.conf mpm_event.load mpm_prefork.conf load mpm_prefork.load
sudo ln -s ../mods-available/mpm_prefork.conf mpm_prefork.conf
sudo ln -s ../mods-available/mpm_prefork.load mpm_prefork.load

While Apache Rivet is available as package libapache2-mod-rivet, this package cannot be used, as it required Tcl/Tk 8.5, instead of 8.6. Thus, we need to compile and link our binary linked with Tcl/Tk 8.6:

sudo apt-get install apache2-dev libtool automake1.10 pkg-config
cd ~
svn co http://svn.apache.org/repos/asf/tcl/rivet/trunk rivet
cd rivet
sh genconf.sh (this may fail with an error)
sh genconf.sh
autoreconf -fi
sh configure --enable-64bit --enable-threads \
--with-tcl=/opt/ActiveTcl-8.6/lib \
 --with-tclsh=/opt/ActiveTcl-8.6/bin/tclsh8.6 \
--with-apxs=/usr/bin/apxs2 \
--with-rivet-core=apache-2 \
--with-rivet-target-dir=/usr/lib/tcltk/rivet2.2 \
--enable-version-display

If 'configure' was successful, Apache Rivet is ready for compilation:

make

Finally, install Apache Rivet with the usual:

sudo make install

You can check that the binary has been installed in /usr/lib/apache2/modules/mod_rivet.so:

ldd -r /usr/lib/apache2/modules/mod_rivet.so

You can also check that the library has been installed in /usr/lib/tcltk/rivet2.2/:

ls /usr/lib/tcltk/rivet2.2/

Create a text file named as "/etc/apache2/mods-available/rivet.conf", and put the following code inside:

<IfModule mod_rivet.c>
  AddType "application/x-httpd-rivet; charset=utf-8" .rvt
  AddType "application/x-rivet-tcl; charset=utf-8"   .tcl
  <FilesMatch "\.tcl$">
     SetHandler application/x-rivet-tcl
  </FilesMatch>
## Replace the following path to server_init.tcl with the correct one...
  RivetServerConf GlobalInitScript "set UserHomeDir /home/petasis;source -encoding utf-8 $UserHomeDir/ellogon-apache-services/server/server_init.tcl"
</IfModule>
Alias /ellogon /home/petasis/ellogon-apache-services/site
<Directory /home/petasis/ellogon-apache-services/site>
  AddOutputFilterByType DEFLATE text/html text/plain application/xml application/json
  DirectoryIndex index.html index.htm index.shtml index.cgi index.tcl index.rvt

  AllowOverride None
  Order allow,deny
  Allow from all
  Require all granted
</Directory>

Create a text file named as "/etc/apache2/mods-available/rivet.load", and put the following code inside:

LoadModule rivet_module /usr/lib/apache2/modules/mod_rivet.so

6) Enable the Apache Rivet module

sudo ln -s /etc/apache2/mods-available/rivet.load /etc/apache2/mods-enabled/rivet.load
sudo ln -s /etc/apache2/mods-available/rivet.conf /etc/apache2/mods-enabled/rivet.conf

7) Restart Apache2

sudo service apache2 restart

8) Test that everything works

Start your favorite Web browser, and try http://localhost/ellogon/test.tcl. You should see something like "Ellogon 1.9.3".