How to install Collabora Online on Nextcloud 17 on a Debian 10 LEMP system. No docker required!

Add Collabora CODE repository

Import the Collabora CODE signing key:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0C54D189F4BA284D

Add the Collabora CODE repository to the apt sources list:

# File: /etc/apt/sources.list.d/collabora.list
# Collabora CODE
deb https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-debian10 ./

Update apt database:

sudo apt update

Install Collabora/CODE

Install the Collabora Code packages:

sudo apt install loolwsd collaboraoffice6.0

If required, install the dictionaries:

sudo apt install collaboraoffice6.0-dict-pt-pt

Configure Collabora/CODE

The default loolwsd configuration (/etc/loolwsd/loolwsd.xml) looks for an SSL certificate and key, which are not present, so lets disable SSL, and optionally enable SSL termination, then set up the reverse proxy.

# File: /etc/loolwsd/loolwsd.xml
    # [...]
    <ssl desc="SSL settings">
        <enable type="bool" default="true">false</enable>
        <termination desc="Connection via proxy where loolwsd acts as working via https, but actually uses http." type="bool" default="true">true</termination>
    # [...]

Finally adjust your trusted domain in /etc/loolwsd/loolwsd.xml by replacing adding the domain with the WOPI client you’re running:

# File: /etc/loolwsd/loolwsd.xml
    # [...]
    <storage desc="Backend storage">
        <filesystem allow="false" />
        <wopi desc="Allow/deny wopi storage. Mutually exclusive with webdav." allow="true">
            <host desc="Regex pattern of hostname to allow or deny." allow="true">localhost</host>
            <host desc="Regex pattern of hostname to allow or deny." allow="true">cloud\.fribeiro\.org</host>
    # [...]

Restart Collabora:

sudo systemctl restart loolwsd

Setup nginx as a reverse proxy

You can either run this reverse proxy on a separate (sub-)domain or add it to the same domain your Nextcloud runs on. Add a new server block to your nginx config or add the location entries to an existing one if you’re re-using the same domain.

server {
  listen       443 ssl;
  server_name  cloud.example.com;
  # You can also set a dedicated domain instead:
  # server_name  office.example.com;

  ssl_certificate /path/to/your/certificate;
  ssl_certificate_key /path/to/your/key;

  # [...]

  # Static files
  location ^~ /loleaflet {
    proxy_pass http://127.0.0.1:9980;
    proxy_set_header Host $http_host;
  }

  # WOPI discovery URL
  location ^~ /hosting/discovery {
    proxy_pass http://127.0.0.1:9980;
    proxy_set_header Host $http_host;
  }

  # Capabilities
  location ^~ /hosting/capabilities {
    proxy_pass http://localhost:9980;
    proxy_set_header Host $http_host;
  }

  # Main websocket
  location ~ ^/lool/(.*)/ws$ {
    proxy_pass http://127.0.0.1:9980;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $http_host;
    proxy_read_timeout 36000s;
  }

  # Download, presentation and image upload
  location ~ ^/lool {
    proxy_pass http://127.0.0.1:9980;
    proxy_set_header Host $http_host;
  }

  # Admin Console websocket
  location ^~ /lool/adminws {
    proxy_pass http://127.0.0.1:9980;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $http_host;
    proxy_read_timeout 36000s;
  }

  # [...]

}

Restart Collabora:

sudo systemctl restart nginx

Install and config Collabora Online app

Install Collabora Online app.

Configure Nextcloud to use Collabora Office:

  • Navigate to Settings -> Collabora Online
  • Set Collabora Online server to https://cloud.example.com or whatever domain you use for your collabora office reverse proxy;
  • Apply settings.

Enjoy your new Collabora Online Office :-)

References