Zarafa-licensed on any system

From Zarafa wiki

Revision as of 09:43, 19 October 2011 by Milo (Talk | contribs)
Jump to: navigation, search


This article is a community contribution and may include unsupported configurations.


To be able to run the zarafa-licensed daemon on any Linux system, you'll first need a system which Zarafa supports. In this example we'll use a Debian Squeeze system, which is easy to use and doesn't have a lot of dependencies. Either create a virtual machine, or if you already have a debian(-like) system use the following command:

 debootstrap --arch i386 squeeze /home/chroots/squeeze http://ftp.nl.debian.org/debian

You can use any system though, as long as the pre-build Zarafa packages are installable. Note that we use the 32bit version, since that is able to run on both 32bit and 64bit systems.

If you're using a chroot, enter it with the following command:

 chroot /home/chroots/squeeze

Now download the zarafa package from http://download.zarafa.com/community/final/, unpack, and install the license package along with the minimal dependencies. Ignore the installation errors, and let apt-get install all the other system dependencies.

 wget <zarafa>
 tar zxpvf <zarafa>
 cd <zarafa>
 dpkg -i zarafa-licensed* zarafa-client* zarafa-common* zarafa-server*
 apt-get -f install

To see the actual library dependencies of the zarafa-licensed daemon, run the following command:

 ldd /usr/bin/zarafa-licensed

It will show some 20 orso libraries that are required to run. Now we will setup the minimal parts in a new directory:

 mkdir -p /opt/zarafa-licensed/bin
 mkdir -p /opt/zarafa-licensed/lib
 cp -p /usr/bin/zarafa-licensed /opt/zarafa-licensed/bin
 cp -p /usr/lib/libzarafaclient.so /opt/zarafa-licensed/lib/

This makes a very small "chroot" which now contains only the zarafa parts which are required for the zarafa-licensed to start. Now we need to add the system requirements. Either copy all the libraries mentioned from the 'ldd' output into /opt/zarafa-licensed/lib/ or use a tool which does this for you:

 apt-get install mklibs
 mklibs -d /opt/zarafa-licensed/lib /opt/zarafa-licensed/bin/*

Now we have a full environment which is able to correctly run the zarafa-licensed daemon in /opt/zarafa-licensed. Since this is not in a default system directories, we need to tell the system were it can find the zarafa-licensed dependencies. This is done like so:

 LD_LIBRARY_PATH=/opt/zarafa-licensed/lib/ ldd /opt/zarafa-licensed/bin/zarafa-licensed 

Note that this time we run 'ldd' again, but force it to lookup the shared libraries in the minimized environment. All dependencies should be resolved, and located in /opt/zarafa-licensed/lib/. Now make a tar.gz in a specified location containing all the files we just copied:

 cd /opt && tar zcpvf /root/zarafa-licensed-full.tar.gz zarafa-licensed

Exit the chroot, and copy the tar file to the machine you would like to run the zarafa-licensed daemon on. Eg:

 cd /home/chroots/squeeze/root/
 scp zarafa-licensed-full.tar.gz <destination system>

On the destination system, unpack the file in /opt again:

 cd /opt
 tar zxpvf /path/to/zarafa-licensed-full.tar.gz

If you're running a 64bit system, and used this example to make a 32bit license daemon, your system needs some dependencies to run 32bit programs. This differs a bit from system to system. Eg, on Fedora:

 yum install glibc.i686

Or on Ubuntu:

 apt-get install libc6-i386

You should now be able to run the 'ldd' command again, and see that all the dependencies can be resolved:

 LD_LIBRARY_PATH=/opt/zarafa-licensed/lib/ ldd /opt/zarafa-licensed/bin/zarafa-licensed 

The full list must point to resolved libraries. If any libraries prints "not found" as a result, you're missing that library, and need to copy that file to the destination system from the minimized system we created earlier.

To actually run the zarafa-licensed daemon, we still need to tell the system where to find required system libraries and where to find the new libraries. So we need to add the system directories first to the LD_LIBRARY_PATH, like this:

 LD_LIBRARY_PATH=/lib:/opt/zarafa-licensed/lib/ /opt/zarafa-licensed/bin/zarafa-licensed -V

This should print the version of the zarafa-licensed program. If it segfaults, you might need to force the first system library to the correct architecture, either /lib32 or /lib64. When this proof of concept works, you can continue.


Finalizing the installation

Copy the configuration file and init script from the minimized system to the destination system in the same locations. Edit the configuration file if required. Since the init script wants the zarafa-licensed in the /usr/bin directory, we'll create a special wrapper script there, that correctly starts the zarafa-licensed daemon from our new location. The script should contain the following lines:

#!/bin/sh

export LD_LIBRARY_PATH=/lib:/opt/zarafa-licensed/lib/
exec /opt/zarafa-licensed/bin/zarafa-licensed $@

Now use the init script to start the license daemon, and monitor the output in the logfile and check if the program stays running.

Personal tools