[HOWTO] Collabora 2.0 without using Docker not for prod

Alert : Read this first :

This How To is only for Home Purpose Only, do not use it on a Production Site. There is a restriction with this Docker image, 10 differents documents at the same time, or 20 connections max at the same time.

On your Home Installation, if the docker version works, don’t try this HOW TO and use docker, it doesn’t worth it.


Hello everyone, here is a Step by Step to use CODE out of Docker on your own server.

Why doing this ?
1- it’s long to compile LOOLWSD / LOLEAFLET and LIBREOFFICE
2- it requires more skills, linux beginers can’t do it
3- it requires a lot of space (more than 5gb) a lot of shared server can’t have a lot of space for that. I have a server with only 10GB SSD for example, i can’t compile LIBREOFFICE
4- You don’t have to setup a proxy/reverse proxy with apache or ngnix

I’ve made and test it on a Ubuntu Server 16.04.1 (it should work well too on Debian last version)

I have also Php 7.0.8 / MariaDB Server 10.1

So first you need a working Nextcloud installation, Apache or Ngnix based with HTTPS and real certs from Letsencrypt or other legit CA.

Then you need docker installed.

A little help with docker, when you run a docker image you will have a long string as an ID for this instance, you can stop it and reload it. I will call this string during this HOWTO : CONTENER_ID

So let’s begin, first you need to lunch the docker image of Collabora, but we won’t use it, so we will lunch it with the minimal options:

docker pull collabora/code
docker run -t -d -p 127.0.0.1:9980:9980 --restart always --cap-add MKNOD collabora/code

You will have as a result the CONTENER_ID : for me it’s 86ac801d0fa9f157c58a1b598455fd0baaea4e305fdb836f0c6ad32be2d87b56

The goal now is to extract the files we need out of the docker image. We will use a lot this command :

docker cp CONTENER_ID:/path/inside/dockerimage /path/inside/harddrive

So here the list of command you will use :

docker cp CONTENER_ID:/opt/collaboraoffice5.1/ /opt/

docker cp CONTENER_ID:/usr/bin/loolforkit /usr/bin/

docker cp CONTENER_ID:/usr/bin/loolmap /usr/bin/

docker cp CONTENER_ID:/usr/bin/loolmount /usr/bin/

docker cp CONTENER_ID:/usr/bin/looltool /usr/bin/

docker cp CONTENER_ID:/usr/bin/loolwsd /usr/bin/

docker cp CONTENER_ID:/usr/bin/loolwsd-systemplate-setup /usr/bin/

docker cp CONTENER_ID:/etc/loolwsd/ /etc/

docker cp CONTENER_ID:/usr/share/loolwsd/ /usr/share/

docker cp CONTENER_ID:/usr/lib/libPocoCrypto.so.45 /usr/lib/

docker cp CONTENER_ID:/usr/lib/libPocoFoundation.so.45 /usr/lib/

docker cp CONTENER_ID:/usr/lib/libPocoJSON.so.45 /usr/lib/

docker cp CONTENER_ID:/usr/lib/libPocoNet.so.45 /usr/lib/

docker cp CONTENER_ID:/usr/lib/libPocoNetSSL.so.45 /usr/lib/

docker cp CONTENER_ID:/usr/lib/libPocoUtil.so.45 /usr/lib/

docker cp CONTENER_ID:/usr/lib/libPocoXML.so.45 /usr/lib/

Let kill docker :

docker stop CONTENER_ID
docker rm CONTENER_ID

It’s was enought for Collabora 1.0 but, since Collabora 2.0, we have to install some libraries for getting it working.

apt-get install libcups2 libgl1-mesa-glx libsm6 libpixman-1-0 libxcb-shm0 libxcb-render0 libxrender1 libcairo2-dev

Now we start the Configuration. Let’s open loolwsd.xml with your favorite text editor :

nano /etc/loolwsd/loolwsd.xml

Line 12 add /usr/share/loolwsd no / after loolwsd between <file_server_root_path> and
</file_server_root_path>

Line 30 to Line 32 modify the path to find the cert files.

Line 38 add a line to allow your Server to connect to Collabora Online :

<host desc="Regex pattern of hostname to allow or deny." allow="true">your.fqdn.com</host>

Line 48 the same :

your.fqdn.com

Line 53 – 54 configure a Username and a Password

Now, activate the Experimental App Collabora for Nextcloud, after that go into your nextcloud admin panel and go to the new section Collabora Online and insert this : https://your.fqdn.com:9980

Then, we will create user lool and some chown – chmod…

useradd lool
sudo setcap cap_fowner,cap_mknod,cap_sys_chroot=ep /usr/bin/loolforkit
sudo setcap cap_sys_admin=ep /usr/bin/loolmount
mkdir /var/cache/loolwsd/
mkdir /opt/lool/child-roots/
chown –R lool:lool /var/cache/loolwsd/
chown –R lool:lool /opt/lool/child-roots/

Now we will lunch the system template setup :

sudo /usr/bin/loolwsd-systemplate-setup /opt/lool/systemplate /opt/collaboraoffice5.1

sudo chown -R lool:lool /opt/lool/systemplate

In order to finish this Step by Step we will create loolwsd service : (thanks to @depawlur)
CAUTION : IT’S ONLY FOR SYSTEMD SYSTEM LIKE UBUNTU 16.04, search How to make a service in Fedora, CentOs or other…

nano /etc/systemd/system/loolwsd.service

[Unit]
Description=loolwsd as a service

[Service]
User=lool
ExecStart=/usr/bin/loolwsd --o:sys_template_path=/opt/lool/systemplate --o:lo_template_path=/opt/collaboraoffice5.1 --o:child_root_path=/opt/lool/child-roots --o:file_server_root_path=/usr/share/loolwsd
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target

then do:
sudo systemctl enable /etc/systemd/system/loolwsd.service
sudo systemctl daemon-reload
sudo systemctl start loolwsd.service

It’s Time to test your Collabora Online.

If something have some lack of explaination, tell it to me, or if you have a more simple solution, tell it to me too.

Now updates ?
Well i don’t know how to update, maybe we will have to delete all and start with the last docker image ?

Thanks for helping me @depawlur @egon @SpiGAndromeda

6 Likes
  • On ubuntu 16.04 you need to create a systemd service and not a cron job.
  • On ubuntu 14.04 you need to create an upstart service
  • Alternatively create a daemon
  • super alternatively do screen and run a command

in your case you will need to kill loolwsd process

I’ve tried to create a systemd service, with no luck, bad error at startup.

How do you make it work in your case ?

man systemd

but here’s what I can think of off top of my head. I don’t have 16.04 with loolwsd now to test it so it may not work

create loolwsd.service in /etc/systemd/system:

[Unit]
Description=loolwsd as a service

[Service]
User=lool
ExecStart=/usr/bin/loolwsd --o:sys_template_path=/opt/lool/systemplate --o:lo_template_path=/opt/collaboraoffice5.1 --o:child_root_path=/opt/lool/child-roots --o:file_server_root_path=/usr/share/loolwsd
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target

then do:
sudo systemctl enable /etc/systemd/system/loolwsd.service
sudo systemctl start loolwsd.service

1 Like

Here is my error log, the same as i did my way… i don’t know where to dig…

Failed to start loolwsd.service: Unit loolwsd.service is not loaded properly: Invalid argument.

My bad, just remove Type=oneshot as it’s not allowed with Restart=

I will edit my previous post
don’t forget to do systemctl daemon-reload

Thanks

I recommend stating that it only works on Ubuntu 16.04 and may not be working on other versions.
There is a certain set of prerequisites that has to be installed in order for it to work “out of the box”.

Hi there,

Just tried this tweak and it’s working !
Thanks.

I had to change 2 or 3 things:

  • Install latest GCC :

    add-apt-repository ppa:ubuntu-toolchain-r/test
    apt-get update
    apt-get install g+Âą4.9

  • In order to less modify loolwsd.xml, I managed to :

    • Run the container with “-e “domain=HOSTNAME””. This avoid to modify lines 38 and 48 as docker does it for you :slight_smile:
    • Remove default certificates and replace it with good ones :
      rm /etc/loolwsd/*.pem
      cp /path/to/cert.pem /etc/loolwsd/cert.pem
      cp /path/to/privkey.pem /etc/loolwsd/key.pem
      cp /path/to/chain.pem /etc/loolwsd/ca-chain.cert.pem
  • There is a mistake on your syntax while launching the system template. Good one is :

sudo /usr/bin/loolwsd-systemplate-setup /opt/lool/systemplate /opt/collaboraoffice5.1/

1 Like

As I had to redo, I wrote a little script that automatize all that stuff :

#!/bin/bash

HOSTNAME=your.fdqn.net
USERNAME=you
PASSWORD=y0uR.P@sww0rd
FILEPATH=/usr/share/loolwsd
CERTPATH=/path/to/certs

docker pull collabora/code
docker run -t -d --name collabora_tmp -p 127.0.0.1:9980:9980 -e "domain=$HOSTNAME"  --restart always --cap-add MKNOD collabora/code

docker cp collabora_tmp:/opt/collaboraoffice5.1/ /opt/
docker cp collabora_tmp:/usr/bin/loolforkit /usr/bin/
docker cp collabora_tmp:/usr/bin/loolmap /usr/bin/
docker cp collabora_tmp:/usr/bin/loolmount /usr/bin/
docker cp collabora_tmp:/usr/bin/looltool /usr/bin/
docker cp collabora_tmp:/usr/bin/loolwsd /usr/bin/
docker cp collabora_tmp:/usr/bin/loolwsd-systemplate-setup /usr/bin/
docker cp collabora_tmp:/etc/loolwsd/ /etc/
docker cp collabora_tmp:/usr/share/loolwsd/ /usr/share/
docker cp collabora_tmp:/usr/lib/libPocoCrypto.so.42 /usr/lib/
docker cp collabora_tmp:/usr/lib/libPocoFoundation.so.42 /usr/lib/
docker cp collabora_tmp:/usr/lib/libPocoJSON.so.42 /usr/lib/
docker cp collabora_tmp:/usr/lib/libPocoNet.so.42 /usr/lib/
docker cp collabora_tmp:/usr/lib/libPocoNetSSL.so.42 /usr/lib/
docker cp collabora_tmp:/usr/lib/libPocoUtil.so.42 /usr/lib/
docker cp collabora_tmp:/usr/lib/libPocoXML.so.42 /usr/lib/

docker stop collabora_tmp
docker rm collabora_tmp

sudo rm /etc/loolwsd/*.pem

sudo cp $CERTPATH/cert.pem /etc/loolwsd/cert.pem
sudo cp $CERTPATH/privkey.pem /etc/loolwsd/key.pem
sudo cp $CERTPATH/chain.pem /etc/loolwsd/ca-chain.cert.pem

sudo sed -i "s@><\/file_server_root_path>@>$FILEPATH<\/file_server_root_path>@g" /etc/loolwsd/loolwsd.xml
sudo sed -i "s@><\/username>@>$USERNAME<\/username>@g" /etc/loolwsd/loolwsd.xml
sudo sed -i "s@><\/password>@>$PASSWORD<\/password>@g" /etc/loolwsd/loolwsd.xml

useradd lool
sudo setcap cap_fowner,cap_mknod,cap_sys_chroot=ep /usr/bin/loolforkit
sudo setcap cap_sys_admin=ep /usr/bin/loolmount
mkdir -p /var/cache/loolwsd/
mkdir -p /opt/lool/child-roots/
chown -R lool:lool /var/cache/loolwsd/
chown -R lool:lool /opt/lool/child-roots/

sudo /usr/bin/loolwsd-systemplate-setup /opt/lool/systemplate /opt/collaboraoffice5.1/
sudo chown -R lool:lool /opt/lool/systemplate 

two commands should be enought to remove it all :

sudo rm -r /opt/collaboraoffice5.1 /usr/bin/lool* /etc/loolwsd /usr/share/loolwsd /usr/lib/libPoco* /var/cache/loolwsd 
sudo deluser lool

Regards.

2 Likes

Thanx a lot for this script. Helped a lot after three days fighting with the docker image. :grin:

gives loads of errors

find: âlib/ld-â: No such file or directory
find: âlib/libcap
â: No such file or directory
find: âlib64/libcapâ: No such file or directory
find: âlib/libattr
â: No such file or directory
find: âlib/libnss_â: No such file or directory
find: âlib64/libnss_â: No such file or directory
find: âvar/cache/fontconfigâ: No such file or directory
find: âusr/lib/locale/en_US.utf8â: No such file or directory
find: âusr/lib/locale/locale_archiveâ: No such file or directory
find: âusr/share/liblangtagâ: No such file or directory
find: âusr/lib/libpng
â: No such file or directory
find: âusr/lib64/libpng
â: No such file or directory
find: âlib/ld-â: No such file or directory
find: âlib/libnss_â: No such file or directory
find: âlib64/libnss_â: No such file or directory
find: âlib/libcap
â: No such file or directory
find: âlib64/libcap
â: No such file or directory
find: âlib/libattr
â: No such file or directory
find: âusr/lib/libpngâ: No such file or directory
find: âusr/lib64/libpng
â: No such file or directory
find: â/opt/poco/libâ: No such file or directory
find: â/opt/poco/libâ: No such file or directory
find: â/usr/lib64â: No such file or directory

i have the same error as above, my server is a X86 machine, does collabora works or it really need a X64 OS?

hi everybody
is there anyone tried this tutorial on ubuntu 16.10 server ?
i did it but collabora still give error i was trying to build collabora with docker but not success then i saw this tutorial
i did all steps but i have still error on nextcloud
Please ask your administrator to check the Collabora Online server setting. The exact error message was: cURL error 7: Failed to connect to office.xyxy.com port 9980: Connection refused
my nextcloud server name is different than office server name (i use https://cloud.xyxy.com)
i have already fqdm for both domains
(i think my problem is in apache ) can somebody share libreoffice.conf file ? (apache config file for collabora)
when i put my collabora (office.xyxy.com:9980) domain my web browser reject connection
many thanks for all

It does work, you may need GCC and some other things though. But it’s hard to say without knowing what loolwsd is saying when you run it.

i already installed GCC
but nothing and nothing i am thinking my problem is in apache config file

also i just found that loolwsd service is down it doesnt want to start
Oct 25 09:23:41 test systemd[1]: Started loolwsd as a service.
Oct 25 09:23:41 test systemd[1]: loolwsd.service: Main process exited, code=exited, status=127/n/a
Oct 25 09:23:41 test systemd[1]: loolwsd.service: Unit entered failed state.
Oct 25 09:23:41 test systemd[1]: loolwsd.service: Failed with result ‘exit-code’.
Oct 25 09:23:41 test systemd[1]: loolwsd.service: Service hold-off time over, scheduling restart.
Oct 25 09:23:41 test systemd[1]: Stopped loolwsd as a service.
Oct 25 09:23:41 test systemd[1]: loolwsd.service: Start request repeated too quickly.
Oct 25 09:23:41 test systemd[1]: Failed to start loolwsd as a service.
Oct 25 09:23:41 test systemd[1]: loolwsd.service: Unit entered failed state.
Oct 25 09:23:41 test systemd[1]: loolwsd.service: Failed with result ‘start-limit-hit’.

Run:
sudo -u lool /usr/bin/loolwsd --o:sys_template_path=/opt/lool/systemplate --o:lo_template_path=/opt/collaboraoffice5.1 --o:child_root_path=/opt/lool/child-roots --o:file_server_root_path=/usr/share/loolwsd

and see if there are any errors

error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
i received error

i have ubuntu 16.10 server with apache and php7
many thanks for your helps