Installing Ellogon HTTP REST Services (Fedora)

This article provides details on how to install the Ellogon HTTP REST services (or any other Ellogon HTTP service) on the Fedora family of operating systems (i.e. CentOS). A similar installation guide for Ubuntu can be found in "Installing Ellogon HTTP REST Services (Ubuntu)".

 

1) Install some needed packages

The graphical package of Tcl (Tk) requires libXft.so.2 and libXss.so.1. If these libraries are not available, you can install them as:

sudo yum install libXft libXScrnSaver

In addition, we will need the wget (optional) and subversion packages:

sudo yum install wget subversion

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/

An easy way to acomplish this task, is through the following command:

sudo echo /opt/ActiveTcl-8.6/lib/ > /etc/ld.so.conf.d/ActiveTcl-8.6-x86_64.conf

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
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 yum install httpd
sudo systemctrl enable httpd.service

Fedora 20 does not provide a package for Apache Rivet, thus we need to compile it from sources and link our binary with Tcl/Tk 8.6 (an 64-bit system is assumed):

sudo yum install httpd-devel libtool automake autoconf zlib-devel
cd ~
svn co http://svn.apache.org/repos/asf/tcl/rivet/trunk rivet
cd rivet
libtoolize -f -c && aclocal && autoheader && automake --add-missing && autoconf
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=/bin/apxs \
  --with-rivet-target-dir=/usr/lib64/rivet2.1/site-packages/mod_rivet \
  --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/lib64/httpd/modules/:

ldd -r /usr/lib64/httpd/modules/mod_rivet.so

You can also check that the library has been installed in /usr/lib64/rivet2.1/site-packages/mod_rivet:

ls /usr/lib64/rivet2.1/site-packages/mod_rivet/

Create a text file named as "/etc/httpd/conf.d/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>

## Change "petasis" to the correct user name...
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/httpd/conf.modules.d/20-rivet.conf", and put the following code inside:

LoadModule rivet_module modules/mod_rivet.so

6) Set the proper SELinux context

sudo chcon -u system_u -r object_r -t httpd_config_t \
/etc/httpd/conf.d/rivet.conf /etc/httpd/conf.modules.d/20-rivet.conf
sudo chcon -R -u unconfined_u -r object_r -t httpd_user_content_t \
$HOME/ellogon-apache-services
sudo setsebool -P httpd_enable_homedirs 1
chmod 755 $HOME

7) Restart Apache2

sudo systemctl restart httpd.service

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".