LibreOffice has long been the best free solution for productivity tools on Linux. However, the standalone LibreOffice client is limited and just doesn’t cut it, when it comes to online, Google Productivity and Google Drive-style collaboration.
That’s where Collabora comes in. It’s a modified version of Libre Office Online, with dozens of features comparable to many proprietary internet office tools. Best of all, the software can integrate directly into many self-hosted cloud solutions. Here’s how you can integrate Libre Office with NextCloud.
Setting up the Collabora software is a bit tedious, but ultimately worth it, especially for those looking to host their own office solution under Linux.
Note: using Collabora software requires a Docker Nextcloud server with a valid SSL certificate. A Snap Nextcloud server will not work, unfortunately.
Set Up Nextcloud On Ubuntu Server
Using Collabora on Nextcloud starts out with a Docker-style Nextcloud server. To start the setup, install Docker and pull the latest Nextcloud container from Docker Hub.
Please keep in mind this setup for Collabora works best with Ubuntu server, so the tutorial will primarily focus on it. However, if you do not use Ubuntu server, follow along as the instructions are very similar on most systems.
sudo docker pull undeadhunter/nextcloud-letsencrypt
Pulling down the Nextcloud Docker container is very similar to the Snap installation. No setup or configuration is necessary. Instead, exit Root and drop down to a regular user.
Note: to access Collabora outside of LAN, you’ll need to set up SSL with Nextcloud and Docker. Refer to the official documentation to learn how to set this up.
sudo docker run -it --name nextcloud --hostname nextcloud-letsencrypt -e CERTBOT_DOMAIN="nextcloud-letsencrypt" -e CERTBOT_EMAIL="email" -p 80:80 -p 443:443 undeadhunter/nextcloud-letsencrypt
If the command is successful, Nextcloud should be running. Access it via a web browser:
Follow the steps to set up a Nextcloud installation within the Docker container. When done, open up a new tab and generate a new SSL certificate with LetsEncrypt.
sudo docker exec -it nextcloud-crypt /certbot.sh
Set Up Collabora
The Nextcloud Docker server is up and running. Next, it’s time to set up the Collabora server, so that it can interact with Nextcloud and the Collabora Office plugin.
Like Nextcloud, the Collabora software must also run within a Docker image. Pull down the latest version of the Collabora server software with the docker pull command:
sudo docker pull collabora/code
Collabora must run alongside Nextcloud, to work. Using the docker run command, start up the server. Be sure to edit the command and change “nextcloud\\server\\address”, to suit your needs.
Note: Do not remove the backslash symbols!
sudo docker run -t -d -p 127.0.0.1:9980:9980 -e 'domain=nextcloud\\server\\address' --restart always --cap-add MKNOD collabora/code
Apache Reverse Proxy
The Collabora software needs a reverse proxy to work effectively. Running the reverse proxy requires Apache2, so be sure to have it on the server already. On Ubuntu, the Apache2 server can easily be installed with:
sudo apt install lamp-server^
When Apache2 is set up, use a2enmod to enable the proxy modules. These modules are important, and the reverse proxy will not run without them.
sudo a2enmod proxy sudo a2enmod proxy_wstunnel sudo a2enmod proxy_http sudo a2enmod ssl
With the modules working, it’s time to create a new Virtual Host file. In the terminal, use touch to create a new config file.
sudo touch /etc/apache2/sites-available/your-collabora-site.com.conf
Collabora requires an SSL certificate to run the proxy, as well as the software. The fastest way to accomplish this task is to use the LetsEncrypt tool. In the terminal, run the following command to get LetsEncrypt for Apache2.
sudo apt install letsencrypt python-letsencrypt-apache
sudo letsencrypt --apache --agree-tos --email email-address -d collabora-server-ip-or-domain.com
Open the new virtual host file with Nano.
sudo nano /etc/apache2/sites-available/your-collabora-site.conf
Paste the following code into Nano:
# Encoded slashes need to be allowed
# Container uses a unique non-signed certificate
# keep the host
# static html, js, images, etc. served from loolwsd
# loleaflet is the client part of LibreOffice Online
ProxyPass /loleaflet https://127.0.0.1:9980/loleaflet retry=0
ProxyPassReverse /loleaflet https://127.0.0.1:9980/loleaflet
# WOPI discovery URL
ProxyPass /hosting/discovery https://127.0.0.1:9980/hosting/discovery retry=0
ProxyPassReverse /hosting/discovery https://127.0.0.1:9980/hosting/discovery
# Main websocket
ProxyPassMatch "/lool/(.*)/ws$" wss://127.0.0.1:9980/lool/$1/ws nocanon
# Admin Console websocket
ProxyPass /lool/adminws wss://127.0.0.1:9980/lool/adminws
# Download as, Fullscreen presentation and Image upload operations
ProxyPass /lool https://127.0.0.1:9980/lool
ProxyPassReverse /lool https://127.0.0.1:9980/lool
Press Ctrl + O to save the document, then restart Apache 2 with:
sudo sytemctl restart apache2
Integrate LibreOffice With Nextcloud
All of the setup required to Run Collabora is taken care of. All that’s left is to integrate LibreOffice With Nextcloud. To enable the integration, open up the Nextcloud web interface, select the gear icon, and click on the “Apps” button.
Look through the apps section for “Collabora”, and click the button to install it. Then, return to the Nextcloud admin interface, and click “Admin,” then “Collabora Online.”
In the “Collabora Online” section of the Admin interface, fill out the IP address to the Collabora Online server, and click the “Apply” button to save the settings.
From here, it will be possible for anyone to access and use the Access Nextcloud Collabora from any PC, via the Nextcloud Web interface.