How to Integrate Collabora Online Server with Nextcloud on Ubuntu 16.04

This tutorial is going to show you how to install Collabora online server on Ubuntu 16.04 and then integrate it with an existing Nextcloud server.

Collabora online is a self-hostable and LibreOffice-based open source online office suite. Its features includes:

  • Basic editing
  • High fidelity, WYSIWYG rendering
  • Supports DOC, DOCX, PPT, PPTX, XLS, XLSX, ODF document format
  • Import and view Visio, Publisher and 100+ more
  • Shared Editing


It’s assumed that you have already set up a Nextcloud server which can be on any Linux distribution. If you use Ubuntu 16.04 or Arch Linux, then you can check out the following easy-to-understand guides.

The Collabora Online server and Nextcloud server can be on the same machine or on two different machines. This tutorial shows how to install Collabora online server on Ubuntu 16.04 using a Docker image built by Collabora and Nextcloud. Then integrate it with an existing Nextcloud server.

Step 1: Install Docker on Ubuntu 16.04

If you want the latest Docker version, you can install Docker from Docker’s APT repository. For simplicity, this tutorial install Docker from the default Ubuntu software repository. Fire up a terminal window (CTRL+ALT+T) and run the following command to install Docker from Ubuntu repository.

sudo apt update
sudo apt install

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

systemctl status docker

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

Be default, Docker uses AUFS as the storage driver on Debian and Ubuntu. In order to make it work with Collabora online office, you will need to switch to the device mapper storage driver by following the instructions below.

Create the following directory.

sudo mkdir /etc/systemd/system/docker.service.d

Create a new file under this directory.

sudo nano /etc/systemd/system/docker.service.d/DeviceMapper.conf

Paste the following text into the file.

ExecStart=/usr/bin/dockerd --storage-driver=devicemapper -H fd://

Save and close the file. Then reload Systemd and restart Docker deamon.

sudo systemctl daemon-reload

sudo systemctl restart docker

Now issue the following command, you will see that the storage driver in use is devicemapper.

sudo docker info


Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 1
Server Version: 1.13.1
Storage Driver: devicemapper
 Pool Name: docker-253:1-515579-pool

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

collabora online docker image

Then run this docker container. Replace nextcloud\\.your-domain\\.com with your nextcloud server domain (preserving backslash).

sudo docker run -t -d -p -e 'domain=nextcloud\\.your-domain\\.com' --restart always --cap-add MKNOD collabora/code

The Collabora online server will be listening on port 9980 of localhost ( as can be shown by issuing this command:

sudo netstat -lnpt

collabora online server daemon

Step 3: Set up Reverse Proxy

Nextcloud server requires a TLS/SSL certificate on the Collabora online server, so we will need to create a virtual host, give the virtual host a domain name, install TLS/SSL certificate and set up a reverse proxy. We can use either Apache or Nginx to achieve this.

First let us see how to do this with Apache.

Set up Apache Virtual Host

Install Apache web server with the following command:

sudo apt install apache2

Run the following command to create an Apache virtual host file. Replace the domain name with your actual domain name for Collabora online server. Don’t forget to create an A record for this domain name.

sudo nano /etc/apache2/sites-available/

Put the following text into the file.

<VirtualHost *:80>

Save and close the file. Enable this virtual host with the following command:

sudo a2ensite

Then restart Apache.

sudo systemctl restart apache2

HTTPS helps us prevent man-in-the-middle attack and password sniffing. We can obtain a free TLS/SSL certificate from Let’s Encrypt CA. First Let’s install the certbot client. The client is still named letsnecrypt in Ubuntu repository. The following command will install the client and apache plugin.

sudo apt install letsencrypt python-letsencrypt-apache

Now issue the following command to obtain a free TLS/SSL certificate. Replace the red-colored text with your actual data.

sudo letsencrypt --apache --agree-tos --email your-email-address -d

You will be asked to choose easy or secure. It’s recommended to choose secure so that all http requests will be redirected to https.

let's encrypt apache

Once you hit the OK button, a free TLS/SSL certificate is obtained and installed on the Apache virtual host.

Set up Apache Reverse Proxy

To be able to proxy traffic using Apache, run the following commands to enable each of these Apache modules.

sudo a2enmod proxy proxy_wstunnel proxy_http ssl

Then run the following command to edit the new virtual host file created by Let’s Encrypt ( certbot ) client.

sudo nano /etc/apache2/sites-enabled/

Add the green text to this file so it looks like the following.

<IfModule mod_ssl.c>
<VirtualHost *:443>

  SSLCertificateFile /etc/letsencrypt/live/
  SSLCertificateKeyFile /etc/letsencrypt/live/
  Include /etc/letsencrypt/options-ssl-apache.conf

  # Encoded slashes need to be allowed
  AllowEncodedSlashes NoDecode

  # Container uses a unique non-signed certificate
  SSLProxyEngine On
  SSLProxyVerify None
  SSLProxyCheckPeerCN Off
  SSLProxyCheckPeerName Off

  # keep the host
  ProxyPreserveHost On

  # static html, js, images, etc. served from loolwsd
  # loleaflet is the client part of LibreOffice Online
  ProxyPass /loleaflet retry=0
  ProxyPassReverse /loleaflet

  # WOPI discovery URL
  ProxyPass /hosting/discovery retry=0
  ProxyPassReverse /hosting/discovery

  # Main websocket
  ProxyPassMatch "/lool/(.*)/ws$" wss://$1/ws nocanon

  # Admin Console websocket
  ProxyPass /lool/adminws wss://

  # Download as, Fullscreen presentation and Image upload operations
  ProxyPass /lool
  ProxyPassReverse /lool


Save and close the file. Then restart Apache web server.

sudo systemctl restart apache2

Now let’s see how to achieve the same results with Nginx. 

Set up Nginx Virtual Host

Install Nginx on Ubuntu 16.04 with the following command:

sudo apt install nginx

Create a virtual host file. Replace the domain name with your actual domain name for Collabora online server. Don’t forget to create an A record for this domain name.

sudo nano /etc/nginx/conf.d/

Put the following text into the file.

server {
  listen 80;

  root /usr/share/nginx/office;

Save and close the file. Create a directory for this virtual host.

sudo mkdir /usr/share/nginx/office

And let the Nginx user (www-data) be the owner of this directory.

sudo chown www-data:www-data /usr/share/nginx/office -R

Reload Nginx server.

sudo systemctl reload nginx

Now let’s obtain a free TLS certificate from Let’s encrypt. Install certbot client with:

sudo apt install letsencrypt

Then use the webroot plugin to obtain the certificate. Replace red text with your actual data.

sudo letsencrypt certonly --webroot --email your-email-address -d -w /usr/share/nginx/office/

You will see the following text indicating that you have successfully obtained a TLS certificate. Your certificate and chain have been saved at /etc/letsencrypt/live/ directory.

Let's encrypt free tls certificate

Setting up Nginx reverse Proxy

Edit the virtual host file.

sudo nano /etc/nginx/conf.d/

Change the configuration to the following.

server {
  listen 443 ssl;
  root /usr/share/nginx/office;

  ssl_protocols TLSv1.1 TLSv1.2;
  ssl_certificate /etc/letsencrypt/live/;
  ssl_certificate_key /etc/letsencrypt/live/;

  # static files
  location ^~ /loleaflet {
    proxy_pass https://localhost:9980;
    proxy_set_header Host $http_host;

  # WOPI discovery URL
  location ^~ /hosting/discovery {
    proxy_pass https://localhost:9980;
    proxy_set_header Host $http_host;

  # websockets, download, presentation and image upload
  location ^~ /lool {
    proxy_pass https://localhost:9980;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $http_host;

Save and close the file. Then test nginx configuration and reload Nginx.

sudo nginx -t

sudo systemctl reload nginx

Final Step: Connect Nextcloud to Collabora Online Server

In order to connect your Nextcloud server to Collabora online server, first you need to enable experimental apps in Nextcloud.

In your Nextcloud dashboard, go to Apps,

nextcloud apps

Then click the gear icon on the bottom-left corner and check Enable experimental apps.

 collabora online server experimental app

Next, click Productivity tab on the left, find the Collabora Online connector app and click Enable button.

nextcloud collabora online connector

Update:  Nextcloud might have changed the Apps interface. If you can’t find Productivity tab, then go to Not Enabled tab, find and enable Collabora Online connector app. The Collabora Online connector app might also changed its name to Collabora Online.

Finally, go to Nextcloud admin page. Click Additional settings tab on the left. Scroll down to Collabora Online section and enter the domain name of your Collabora online server including https:// prefix. Don’t forget to click Apply button.

collabora online

Now you should see a new Office app from the drop-down menu.

collabora online app

And you are able to create Word, spreadsheet and presentation documents right from your Nextcloud server.

collabora online nextcloud

That’s it!

I hope this tutorial helped you install, run Collabora online server on Ubuntu 16.04 and integrate it with Nextcloud. As always, if you found this post useful, then subscribe to our free newsletter.You can also follow us on Google+Twitter or like our Facebook page.

Rate this tutorial
[Total: 39 Average: 3.9]