Install Collabora Online with Docker on Ubuntu in ZenTao
Tags: collaboraoffice, docker, ubuntu, zentao
Published: 2021-01-26 02:36:51

### Step 1: Install Docker on Ubuntu
For simplicity, this tutorial installs Docker from the default Ubuntu software repository.

`sudo apt update
sudo apt install docker.io`

Once installed, the Docker daemon should be automatically started. You can check its status with:

`systemctl status docker`
![docker](https://cdn.zsite.net/us1/upload/202012/f_1adb4c3149f0af81bdbffb883255d65e.png)
Hint: If the above command doesn’t quit immediately, you can press the Q key to make it quit.

If it’s not running, then start the daemon with this command:

`sudo systemctl start docker`

And enable autostart at boot time:

`sudo systemctl enable docker`

### Step 2: Install and Run Collabora Online Server with Docker

Execute the following command to pull the latest Collabora Online Development Edition image from Docker hub.

`sudo docker pull collabora/code`
![code](https://cdn.zsite.net/us1/upload/202012/f_113b391ebcf2c5bd6850ad44572d3919.png)

Then start a new container, for example:

`sudo docker run -t -d -p 0.0.0.0:9980:9980 -e "domain=example\\.com" -e "username=admin" -e "password=123456" --restart always --cap-add MKNOD collabora/code`

Replace example\\.com with your server/ZenTao hostname, preseving the double slashes. This is because Collabora only allows known hosts to access its service and we need to add the server/ZenTao hostname to the whitelist with the domain= parameter.

-d: Detached mode makes the container run in the background.
-t: Allocate a pseudo-TTY
-p: Publish a container’s port to the host.
-e: Set environment variables

The Collabora Online server will be listening on port 9980 of localhost (127.0.0.1) as can be shown by issuing the following command. (If your Ubuntu system doesn’t have the netstat command, you can install it with sudo apt install net-tools.)

`sudo netstat -lnpt | grep docker`

Since I am using 

`sudo docker run -t -d -p 0.0.0.0:9985:9980 -e 'domain=192\\.168\\.2\\.111' -e "username=admin" -e "password=123456" --restart always --cap-add MKNOD collabora/code`
![example 1](https://cdn.zsite.net/us1/upload/202012/f_95cf4f9f4481a534a860f4295534bcaa.png)

So I get this result
![example2](https://cdn.zsite.net/us1/upload/202012/f_8aea1f854bd1ff393b4741ade08d314c.png)

Go to browser and visit https://your domian:9985 (Since  SSL is enabled by default, so you have to visit by HTTPS if you haven't edited configuration file of Collabora Online ), you will get a "OK" page.
![visit](https://cdn.zsite.net/us1/upload/202012/f_878bc6fad8357d45d9176f6eb8cae39e.png)

Since my ZenTao is not running with SSL, so I need to configure loolwsd.xml to disable SSL. ( If ZenTao is running with SSL, then Collabora has to run with SSL as well, it's the same if ZenTao disables SSL. Otherwise Collabora Online will not be enabled successfully in ZenTao ) 

### Step 3: Use the configuration file directly to set Collabora Online

After starting the container, you can copy the configuration file out of the container, edit it, and copy it back to the container. The container will notice that the configuration file has changed, and the service will be restarted (don’t forget the –restart always option when you start the container with docker run).

1. Find out the name or hash of your container:
`$sudo docker ps`

The output would be something like this:
`CONTAINER ID        IMAGE                                   COMMAND                  CREATED             STATUS              PORTS                                           NAMES
e4212ca0e6d6        collabora/code                          "/bin/sh -c 'bash st…"   25 minutes ago      Up 25 minutes       0.0.0.0:9985->9980/tcp                          admiring_sinoussi`

2. Copy out the config file:
`$sudo docker cp admiring_sinoussi:/etc/loolwsd/loolwsd.xml loolwsd.xml`

For disable SSL, make sure you have editted value for SSL settings as "false"

`<ssl desc="SSL settings">
            <as_scheme type="bool" default="true" desc="When set we exclusively use the WOPI URI's scheme to enable SSL for storage">false</as_scheme>
            <enable type="bool" desc="If as_scheme is false or not set, this can be set to force SSL encryption between storage and loolwsd. When empty this defaults to following the ssl.enable setting"></enable>`

`<ssl desc="SSL settings">
        <enable type="bool" desc="Controls whether SSL encryption between browser and loolwsd is enabled (do not disable for production deployment). If default is false, must first be compiled with SSL support to enable." default="true">false</enable>`

3. Edit the config file with your favourite editor, then save and copy it back to the container:

`$sudo docker cp loolwsd.xml admiring_sinoussi:/etc/loolwsd/loolwsd.xml`

Wait a few seconds for the automatic restart.

You might meet the problem that the container could not restart successfully and logs is as the following, 
![example3]（https://cdn.zsite.net/us1/upload/202012/f_efa96f2c559356814f8b2f2062a79a2a.png）

`Getting CA Private Key
Can't open /etc/loolwsd/loolwsd.xml: Permission denied.
Can't open /etc/loolwsd/loolwsd.xml: Permission denied.
Can't open /etc/loolwsd/loolwsd.xml: Permission denied.
Can't open /etc/loolwsd/loolwsd.xml: Permission denied.
Can't open /etc/loolwsd/loolwsd.xml: Permission denied.
/etc/loolwsd/proof_key exists already.
Setting up watches.
Couldn't watch /etc/loolwsd/loolwsd.xml: Permission denied
-rw-r----- 1 root root 18191 Dec  7 01:42 /etc/loolwsd/loolwsd.xml modified --> restarting
Try with the following commands to fix the problem by chown beacause of "Permission denied"
sudo docker stop admiring_sinoussi
sudo docker start admiring_sinoussi
sudo docker exec -it -u root admiring_sinoussichown lool:lool /etc/loolwsd/loolwsd.xml`

And then visit http://192.168.2.111:9985, you will get a "OK" page if you succeed.

Step 4: Set up in ZenTao
Go to Admin - Integration - Office to enable LibreOffice and Check "Collabora Online", for Collabora Path, just fill in with exact address and port number for your Collabora Online.

Go to Doc in ZenTao and create a Word file to see if it's working.
![ZenTao integration]（https://cdn.zsite.net/us1/upload/202012/f_ea771bb31f25b8c9e89725b8e2e35694.jpg）

Open "test sprint doc"

If you check Track Changes with "Record", you could roll back editing by you or your teammates in Track Changes - Manage

![Collabora Record](https://cdn.zsite.net/us1/upload/202012/f_e5f3c76c197a60eaedf63439377f007e.png)

Read the original post [HERE](https://www.zentao.pm/blog/install-collabora-online-with-docker-on-ubuntu-in-zenao-819.html?u=tengfei&utm_source=bl&utm_medium=dev&utm_campaign=renee&utm_content=docker)