Installing Clerezza as a Service

The following describes ho to install Clerezza as a service, i.e. to start up in the background typically when the system is bootet. It is recommended to first try to start Clerezza manually following the instrcutions here.

On Ubuntu Linux

The following is known to work on recent Ubuntu Linux distributions.

You need to place a clerezza.conf file in the directory /etc/init. The following is an example that assumes Clerezza is to be run as user reto in /home/reto/clerezza using the jar platform.launcher.jar therein.

# Apache Clerezza - job file description "Start Apache Clerezza as user reto" # When to start the service start on runlevel [2345] # When to stop the service stop on runlevel [016] # Automatically restart process if crashed respawn # Start the process exec su reto sh -c "cd /home/reto/clerezza && java -XX:MaxPermSize=400m -Xmx800m -jar platform.launcher.jar -NCS"

Forwarding ports

By default Clerezza listens to port 8080 for http requests and to port 8022 for ssh connections. As Clerezza is typically run as an unpriviledged user (user reto in the example above) it cannot listen to default ports like port 80 for the web.
One way to redirect the default web port 80 to port 8080 is to use xinetd. This is not installed by default.
Install xinetd with
sudo apt-get install xinetd

For redirecting the http port 80 to 8080 you can place a file with following content into the directory /etc/xinet.d.

service http { disable = no flags = REUSE socket_type = stream protocol = tcp user = root wait = no port = 80 redirect = 8080 log_type = FILE /tmp/xinetdssl.log }
Finally tell xinetd to reload the config with:
sudo /etc/init.d/xinetd reload
Alternatives to xinetd include inet.d and iptables

On other platforms

When running clerezza as service you should start it with the -NCS command line option as it otherwise attempts to open a shell on the console (which is not available to services)