Install Collabora Online on Ubuntu 20 for Nextcloud

First, log in to your Ubuntu 20.04 server through SSH as the root user or any other user with sudo privileges:

ssh root@IP_Address -p Port_number

You will need to replace ‘IP_Address‘ and ‘Port_number‘ with your server’s respective IP address and SSH port number. Additionally, replace ‘root’ with the username of the system user with sudo privileges.

You can check whether you have the proper Debian version installed on your server with the following command:

$ lsb_release -a

You should get this output:

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal

Before starting, you have to make sure that all Ubuntu OS packages installed on the server are up to date. You can do this by running the following commands:

$ sudo apt update -y
$ sudo apt upgrade -y

Install Collabora

In this article, we will show you how to install Collabora from the Ubuntu repository. This article assumes that you already have a working Nextcloud instance.

First, let’s install dependencies.

$ sudo apt install apt-transport-https ca-certificates

Next, we will add the Collabora Online official repository, let’s start this by importing the signing key.

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

Then, let’s create a package source file /etc/apt/sources.list.d/collaboraonline.sources

$ sudo nano /etc/apt/sources.list.d/collaboraonline.sources

Add the following contents to the file

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

Save the file then exit. Now, we need to download the package information from the newly added source above.

$ sudo apt update

Finally, we can install Collabora Online Development Edition by running the command below.

$ sudo apt install coolwsd code-brand

That’s it. Collabora Online Development Edition has been successfully installed on your Ubuntu 20.04 server.

Configure Collabora

By default, the Collabora Online Socket Daemon enables a TLS connection. So, upon installation, when checking the daemon status, it will return an error or it fails to start because the service is unable to locate the certificate file.

$ sudo systemctl status coolwsd

To get this fixed, we can disable TLS in coolwsd and enable the TLS termination at the reverse proxy.

$ sudo coolconfig set ssl.enable false
$ sudo coolconfig set ssl.termination true

Now, to allow connection from your Nextcloud service, we need to run this command.

$ sudo coolconfig set storage.wopi.host nextcloud.yourdomain.com

Please make sure you replace nextcloud.yourdomain.com with your actual domain/subdomain that hosts your Nextcloud.

The changes made by running the commands above will be written to /etc/coolwsd/coolwsd.xml.

To create an administrator user and its password, you can run this command

$ sudo coolconfig set-admin-password

The output will be like this:

Enter admin username [admin]:
Enter admin password:
Confirm admin password:
Saving configuration to : /etc/coolwsd/coolwsd.xml …
Saved

Every time you make changes to the /etc/coolwsd/coolwsd.xml file, you need to restart the Collabora daemon.

$ sudo systemctl restart coolwsd
$ sudo systemctl status coolwsd

As seen in the picture, the Collabora daemon is now running.

Configure Reverse Proxy using Apache

In this article, we will use Apache as the reverse proxy to Collabora. The connection between Nexcloud and Collabora should be established through a TLS enabled connection. To achieve this we will create an Apache virtual host and install an SSL certificate for it.

$ apt install apache2
$ sudo nano /etc/apache2/sites-available/collabora.yourdomain.com.conf

Then, insert the following into the file.

<VirtualHost *:80>
ServerName collabora.yourdomain.com
AllowEncodedSlashes NoDecode
ProxyPreserveHost On

# static html, js, images, etc. served from coolwsd
# browser is the client part of Collabora Online
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

# Compatibility with integrations that use the /lool/convert-to endpoint
ProxyPass /lool http://127.0.0.1:9980/cool
ProxyPassReverse /lool http://127.0.0.1:9980/cool
</VirtualHost>

Replace collabora.yourdomain.com with your own domain or subdomain. Save the file and exit, then enable the virtual host.

$ sudo a2ensite collabora.yourdomain.com

Before running the command, make sure you replace collabora.yourdomain.com with the actual domain/subdomain you use to host Collabora.

Next, let’s enable some Apache modules to be able to proxy the traffic using Apache.

$ sudo a2enmod proxy proxy_http proxy_wstunnel

After making the changes above, we need to restart Apache

$ sudo systemctl restart apache2

Reboot the server.

Install SSL Certificate

We are going to install an SSL certificate for Collabora using the free SSL certificate from Lets Encrypt.

$ sudo apt install python3-certbot-apache

Once installed, you can run the command and follow the instruction to install an SSL certificate.

$ sudo certbot

Integrate Collabora with NextCloud

In your Nextcloud dashboard, click on your username on the top right, then click Settings

Under Administration on the left menu, click Nextcloud Office then tick ‘Use your own server’. In the blank field, type your Collabora Online URL then click the SAVE button.

In the advanced settings part, you can also use Office Open XML as the default format, this will make the files created in your Nextcloud compatible with Microsoft Office software.

That’s it. You can test the integration by creating a new file, for example, we can create a spreadsheet.

The new spreadsheet file will be opened, and we can start working on it.

Congratulations! You have successfully integrated Collabora Online with Nextcloud on Ubuntu 20.04.

Src: https://www.rosehosting.com/blog/how-to-integrate-collabora-online-with-nextcloud-on-ubuntu-20-04/

Share

3 thoughts on “Install Collabora Online on Ubuntu 20 for Nextcloud”

  1. Should the following be reversed at the end of the process?

    $ sudo coolconfig set ssl.enable false
    $ sudo coolconfig set ssl.termination true

    Reply
  2. when i got to sudo systemctl restart apache2, i got job for apache2. service failed because the control process exited with error code. now nothing works cant get back into nextcloud what do i do

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.