Install and Config Integrate Collabora Online with Nextcloud For linux

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

  • 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

Collabora is a big contributor to the LibreOffice project. All of the Collabora Online codes will be eventually included in LibreOffice.

Setting up and configuring native CODE packages on Linux

Collabora provide native Linux packages for selected Linux distributions: Debian 9, Debian 10, Ubuntu 16.04, Ubuntu 18.04, Ubuntu 20.04, CentOS 7 (at least 7.2), CentOS 8, SLE 15.x and openSUSE Leap 15.x.

1. Import the signing key

CODE packages are digitally signed by Collabora Productivity Ltd. First step is to import the signing key.

On deb based distributions (Debian, Ubuntu), use the following command:

cd /usr/share/keyrings
sudo wget https://collaboraoffice.com/downloads/gpg/collaboraonline-release-keyring.gpg

On rpm based distributions (CentOS, openSUSE), use the following command:

wget https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-centos7/repodata/repomd.xml.key && sudo rpm --import repomd.xml.key

2. Add CODE package repositories

On deb based distributions (Debian, Ubuntu), create /etc/apt/sources.list.d/collaboraonline.sources with the following contents:

Debian 9:

Types: deb
URIs: https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-debian9
Suites: ./
Signed-By: /usr/share/keyrings/collaboraonline-release-keyring.gpg

Debian 10:

Types: deb
URIs: https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-debian10
Suites: ./
Signed-By: /usr/share/keyrings/collaboraonline-release-keyring.gpg

Debian 11:

Types: deb
URIs: https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-debian11
Suites: ./
Signed-By: /usr/share/keyrings/collaboraonline-release-keyring.gpg

Ubuntu 16.04:

Types: deb
URIs: https://www.collaboraoffice.com/repos/CollaboraOnline/CODE
Suites: ./
Signed-By: /usr/share/keyrings/collaboraonline-release-keyring.gpg

Ubuntu 18.04:

Types: deb
URIs: https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-ubuntu1804
Suites: ./
Signed-By: /usr/share/keyrings/collaboraonline-release-keyring.gpg

Ubuntu 20.04:

Types: deb
URIs: https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-ubuntu2004
Suites: ./
Signed-By: /usr/share/keyrings/collaboraonline-release-keyring.gpg

Ubuntu 22.04:

Types: deb
URIs: https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-ubuntu2204
Suites: ./
Signed-By: /usr/share/keyrings/collaboraonline-release-keyring.gpg

ARM64 – Ubuntu 18.04:

Types: deb
URIs: https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-arm64-ubuntu1804
Suites: ./
Signed-By: /usr/share/keyrings/collaboraonline-release-keyring.gpg

On rpm based distros (CentOS, RHEL, SUSE), use the following commands:

CentOS 7:

sudo yum-config-manager --add-repo https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-centos7

CentOS 8:

sudo yum-config-manager --add-repo https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-centos8

openSUSE Leap 15.x (and SLE 15):

sudo zypper ar 'https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-opensuse15' 'CODE'
sudo zypper mr -r 'CODE' # enable auto refresh

3. Install packages

On deb based distributions (Debian, Ubuntu), use the following command:

sudo apt update && sudo apt install coolwsd code-brand

On CentOS, use the following command:

sudo yum install coolwsd CODE-brand

On openSUSE Leap, use the following command:

sudo zypper ref && sudo zypper in coolwsd CODE-brand

This is the minimal installation, without localizations. For full installation install ‘collaboraoffice*’ packages.

4. Configuration

Edit /etc/coolwsd/coolwsd.xml. Collabora Online (coolwsd) service runs via systemd. After editing the configuration file, you have to restart the service:

sudo systemctl restart coolwsd

Collabora Online logs into systemd journal by default. You can check the log with:

sudo journalctl -u coolwsd

The default configuration is looking for an SSL certificate and key, which are not present, so probably it’s the best to disable SSL, and optionally enable SSL termination, then set up the reverse proxy.

II Config CC online (Configure Collabora Online)

firewall: firewall-cmd –zone=public –add-port=9980/tcp –permanent

Required Apache2 modules

Apache2 web server is modular. We need to enable the required modules for this reverse proxy setup. We can use the a2enmod command to enable modules. If a module has been enabled already, nothing happens.

  • Enable proxy in general: a2enmod proxy
  • Enable proxy for HTTP protocol: a2enmod proxy_http
  • Enable SSL support: a2enmod proxy_connect
  • Enable proxy of websockets: a2enmod proxy_wstunnel

On CentOS / RHEL there is no a2enmod available. Enabling the modules has to be done by adjusting a config file and adding the LoadModule manually

[root@www ~]# vi /etc/httpd/conf.modules.d/00-proxy.conf

# add to the end

LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so

Disable TLS for Coolwsd 

It took us some time to find out what was the problem and what could be a possible solution… We have found the necessary information here and here and after the suggested changes, the service started.  To summarize, you will need to change some configuration settings in the /etc/coolwsd/coolwsd.xml file.  To perform these changes, it’s easier to use the cli utility provided..   

sudo coolconfig set ssl.enable false
sudo coolconfig set ssl.termination true
sudo coolconfig set storage.wopi.host <Your NextCloud FQDN>
Collabora Online’s configuration file is /etc/coolwsd/coolwsd.xml.
The proxy redirects incoming requests to 127.0.0.1, but replies from coolwsd server must contain the original host name, otherwise the connection will fail. The service can usually figure out the external host name, except in more complex cases. In that case look for the setting server_name (empty by default), and enter the host name here, for example collaboraonline.example.com

Multihost Configuration

 If you have two hosts:

1. host1 has no aliases

2. host2 has aliases like aliasname1, aliasname2, aliasname3. For all these aliases regex would be aliasname[0-9]{1}.

<alias_groups desc="default mode is 'first' it allows only the first host when groups are not defined. set mode to 'groups' and define group to allow multiple host and its aliases" mode="groups">
<!-- If you need to use multiple wopi hosts, please change the mode to "groups" and
add the hosts below.  If one host is accessible under multiple ip addresses
or names, add them as aliases. -->

   <group>
      <host desc="hostname to allow or deny." allow="true">https://host1:443</host>
   </group>

   <group>
      <host desc="hostname to allow or deny." allow="true">https://host2:443</host>
      <alias desc="regex pattern of aliasname">https://aliasname[0-9]{1}:443</alias>
   </group>

   <!-- More "group"s possible here -->
</alias_groups>

Create & Configure Apache Virtual Host for CODE 

<VirtualHost *:443>
ServerName office.c-nergy.vlab
Options -Indexes

ErrorLog "/var/log/apache2/collabora_error"
# Encoded slashes need to be allowed
AllowEncodedSlashes NoDecode

# keep the host
ProxyPreserveHost On

# static html, js, images, etc. served from coolwsd
# loleaflet/browser is the client part of Collabora Online
ProxyPass /loleaflet http://127.0.0.1:9980/loleaflet retry=0
ProxyPassReverse /loleaflet http://127.0.0.1:9980/loleaflet
ProxyPass /browser http://127.0.0.1:9980/browser retry=0
ProxyPassReverse /browser http://127.0.0.1:9980/browser

# WOPI discovery URL
ProxyPass /hosting/discovery http://127.0.0.1:9980/hosting/discovery retry=0
ProxyPassReverse /hosting/discovery http://127.0.0.1:9980/hosting/discovery

# Capabilities
ProxyPass /hosting/capabilities http://127.0.0.1:9980/hosting/capabilities retry=0
ProxyPassReverse /hosting/capabilities http://127.0.0.1:9980/hosting/capabilities

# Main websocket
ProxyPassMatch "/cool/(.*)/ws$" ws://127.0.0.1:9980/cool/$1/ws nocanon

# Admin Console websocket
ProxyPass /cool/adminws ws://127.0.0.1:9980/cool/adminws

# Download as, Fullscreen presentation and Image upload operations
ProxyPass /cool http://127.0.0.1:9980/cool
ProxyPassReverse /cool http://127.0.0.1:9980/cool

SSLEngine on
SSLCertificateFile /etc/ssl/certs/office-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/office-selfsigned.key

</VirtualHost>

Step 1 – Configure Office settings on Nextcloud Server 

We are reaching almost the final steps to this crazy configuration.  At this stage, we have a fully functional Nextcloud server and we have made available the CODE server.  It’s time that these two software speaks to each other.  This part should be rather easy.  You will need to go to the Nextcloud server, Go to Settings > Administration section and select Office in the left menu (see screenshot below)

NC_PostConfig_32

Click on picture for better resolution

In the Nextcloud office, select the option Use your own server

In the URL input box,  type the FQDN of your Collabora Server (in our scenario, we have used the name office.c-nergy.vlab).  Since we are using self-signed certificate, please ensure that the checkbox, Disable certificate verification (insecure) is enabled.   Save your configuration.  If you see a green check, it means that your configuration is correct and the online office edition is enabled on your Nextcloud server

NC_PostConfig_33

Click on picture for better resolution

Step 2 – Test your configuration 

To do that, you will simply go to your Nextcloud server, go to Documents and select one of the Office document that you want to work on…In our example, we will open a spreadsheet.  After a few moment, you should see the spreadsheet ready for edition within your browser

NC_PostConfig_34

Click on picture for better resolution

In the advance settings, you can also set OOXML as the default format, so the files will be compatible with Microsoft Office software.

office open xml format collabora

Now when you click the add button (+) in Nextcloud, you will be able to create Word, spreadsheet, and presentation documents right from your Nextcloud server. (Note: Firefox has a problem loading .docx files in Nextcloud because Firefox won’t allow SVG image file to load CSS files. You can use Google Chrome or Chromium browser. )

RELATED POST

How to Install SFTPGo on Ubuntu 22.04

Setup UFW Firewall For security reasons, it is recommended to install and configure the UFW firewall in your system. First,…

Executing Bash Scripts at Startup in Ubuntu Linux

Creating a Bash script in Ubuntu To create a Bash script in Ubuntu, you can use any text editor of…

How To Clear PHP’s Opcache

PHP can be configured to store precompiled bytecode in shared memory, called Opcache. It prevents the loading and parsing of PHP…

iLO port configuration on HP servers + license

HP Integrated Lights-Out (iLO) Advanced License 34RQQ-6D5R4-G8NW3-LBMG6-MLJXR325WC-J9QJ7-495NG-CP7WZ-7GJMM iLO 2 Advanced features have been activated License Key: License Key: 35DPH-SVSXJ-HGBJN-C7N5R-2SS4W32Q8Y-XZVGQ-4SGJB-4KY3R-M9ZBN –…