Integrate Collabora Online with Nextcloud on Ubuntu without Docker

This tutorial is going to show you how to install Collabora Online on Ubuntu and then integrate it with an existing Nextcloud server without using Docker.

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.

Note: This tutorial works on Ubuntu 22.04, 20.04 and 18.04. If you are using another Ubuntu version, you can install Collobaora Online with Docker.

collabora online nextcloud server

Prerequisites

It’s assumed that you have already set up a Nextcloud server, which can be on any Linux distribution. If you haven’t already done so, 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 without using Docker. Then integrate it with an existing Nextcloud server.

Step 1: Install Collabora Online on Ubuntu From the Official Repository

Collabora has an official package repository for Ubuntu 22.04, 20.04 and 18.04. Run the following command to add it to your Ubuntu system.

Ubuntu 22.04

echo 'deb https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-ubuntu2204 ./' | sudo tee /etc/apt/sources.list.d/collabora.list

Ubuntu 20.04

echo 'deb https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-ubuntu2004 ./' | sudo tee /etc/apt/sources.list.d/collabora.list

Ubuntu 18.04

echo 'deb https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-ubuntu1804 ./' | sudo tee /etc/apt/sources.list.d/collabora.list

Then run the following command to download and import Collabora public key, which allows APT package manager to verify the integrity of packages downloaded from this repository.

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

ubuntu Collabora public key

If you can’t import the public key with the above command, you can use the following command to download and import the key.

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

Since this repository uses HTTPS connection, we need to install the apt-transport-https and ca-certificates package, so the APT package manager can establish secure connection to the repository.

sudo apt install apt-transport-https ca-certificates

Now update local package index and install Collabora Online. coolwsd is the Collabora Online WebSocket Daemon.

sudo apt update
sudo apt install coolwsd code-brand

Step 2: Configure Collabora Online WebSocket Daemon

After they are installed, you can check the status of coolwsd.

systemctl status coolwsd

LibreOffice Online WebSocket Daemon

Hint: If the above command didn’t quit immediately, you can press the Q key to make it quit.

As you can see, it failed to start. We can check the journal to see why this happened.

sudo journalctl -eu coolwsd

Sample output:

Apr 21 16:13:06 ubuntu coolwsd[13842]: File not found: /etc/coolwsd/ca-chain.cert.pem
Apr 21 16:13:06 ubuntu systemd[1]: coolwsd.service: Main process exited, code=exited, status
Apr 21 16:13:06 ubuntu systemd[1]: coolwsd.service: Failed with result 'exit-code'.
Apr 21 16:13:07 ubuntu systemd[1]: coolwsd.service: Service hold-off time over, scheduling r
Apr 21 16:13:07 ubuntu systemd[1]: coolwsd.service: Scheduled restart job, restart counter i
Apr 21 16:13:07 ubuntu systemd[1]: Stopped LibreOffice Online WebSocket Daemon.
Apr 21 16:13:07 ubuntu systemd[1]: coolwsd.service: Start request repeated too quickly.
Apr 21 16:13:07 ubuntu systemd[1]: coolwsd.service: Failed with result 'exit-code'.
Apr 21 16:13:07 ubuntu systemd[1]: Failed to start LibreOffice Online WebSocket Daemon.

By default, coolwsd enables TLS connection. However, it didn’t find a TLS certificate file, hence the start failure. It’s better to disable TLS in coolwsd and terminate TLS at a reverse proxy. The coolwsd configuration file is located at /etc/coolwsd/coolwsd.xml. However, it’s an XML file, which is not easy to read and edit. We can use the coolconfig tool to change configurations.

Run the following command to disable TLS in coolwsd.

sudo coolconfig set ssl.enable false

And enable TLS termination at the reverse proxy.

sudo coolconfig set ssl.termination true

By default, coolwsd only allows known hosts to access its service. To allow Nextcloud to access the service, run the following command to add your Nextcloud hostname to the whitelist.

sudo coolconfig set storage.wopi.host nextcloud.example.com

You can also enable the admin account for coolwsd with the following command. You will need to set a username and password for the admin account.

sudo coolconfig set-admin-password

Restart coolwsd for the changes to take effect.

sudo systemctl restart coolwsd

Now it should be running without errors.

systemctl status coolwsd

Output:

Collabora Online WebSocket Daemon ubuntu

Step 3: Set up Reverse Proxy

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

Apache

Install Apache web server with the following command:

sudo apt install apache2

Run the following command to create an Apache virtual host file for Collabora Online.

sudo nano /etc/apache2/sites-available/collabora.conf

Put the following text into the file. Replace the domain name with your actual domain name for Collabora Online. Don’t forget to create an A record for this sub-domain.

<VirtualHost *:80>
  ServerName collabora.example.com
  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

</VirtualHost>

Save and close the file. To be able to proxy traffic using Apache, we need to enable some Apache modules.

sudo a2enmod proxy proxy_wstunnel proxy_http

Enable this virtual host with the following command:

sudo a2ensite collabora.conf

Then restart Apache.

sudo systemctl restart apache2

Nginx

Install Nginx on Ubuntu with the following command:

sudo apt install nginx

Create a virtual host file for Collabora Online.

sudo nano /etc/nginx/conf.d/collabora.conf

Put the following text into the file. Replace the domain name with your actual domain name for Collabora Online. Don’t forget to create an A record for this domain name.

server {
    listen 80;
    listen [::]:80;
    server_name  collabora.example.com;

    error_log /var/log/nginx/collabora.error;

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


    # WOPI discovery URL
    location ^~ /hosting/discovery {
        proxy_pass http://localhost: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 ~ ^/cool/(.*)/ws$ {
        proxy_pass http://localhost: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 ~ ^/(c|l)ool {
        proxy_pass http://localhost:9980;
        proxy_set_header Host $http_host;
    }

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

Save and close the file. Then test Nginx configurations.

sudo nginx -t

If the test is successful, reload Nginx server.

sudo systemctl reload nginx

Step 4: Obtain and Install TLS Certificate

Now let’s obtain a free TLS certificate from Let’s encrypt. Run the following commands to install Let’s Encrypt client (certbot) from the default software repository.

sudo apt install certbot

If you use Apache web server, then you also need to install the Certbot Apache plugin.

sudo apt install python3-certbot-apache

Then issue the following command to obtain a free TLS/SSL certificate.

sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d collabora.example.com

If you use Nginx web server, then you need to install the Certbot Nginx plugin.

sudo apt install python3-certbot-nginx

Then use the Nginx plugin to obtain and install the certificate by running the following command.

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d collabora.example.com

You will see the following text indicating that you have successfully obtained a TLS certificate.

collabora nginx reverse proxy https

Final Step: Connect Nextcloud to Collabora Online

In your Nextcloud dashboard, go to the Apps page (https://nextcloud.example.com/settings/apps).

Next, go to Office & Text section, find the Nextcloud Office app, and click Download and Enable button. (Note: The Collabora Online app has been renamed to Nextcloud Office.

collabora online nextcloud office

After this app is enabled, go to Nextcloud Settings page -> Administration -> Click Nextcloud Office tab on the left. By default, it uses the built-in CODE server, which is not suitable for production use. We need to select Use your own server and enter the domain name of your Collabora Online including https:// prefix, then click Save button.

collabora online nextcloud integration docker

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. )

nextcloud online office

collabora online development edition nextcloud integration

The coolwsd admin console is available at https://collabora.example.com/browser/dist/admin/admin.html. You need to enter the username and password, which were created in step 2.

loolwsd admin console

Troubleshooting

You can check the logs of coolwsd to find clues. Perhaps it’s not running.

sudo journalctl -eu coolwsd

And check the logs of web server.

  • Apache: /var/log/apache2/collabora_error
  • Nginx: /var/log/nginx/collabora.error

If the coolwsd admin console displays the “Server has been shutdown. Please reload the webpage” error, and you find the following error in the coolwsd journal log,

ERR Looks like SSL/TLS traffic on plain http port

It’s probably because you specified HTTPS protocol in the Nginx configuration file (/etc/nginx/conf.d/collabora.conf).

https://127.0.0.1:9980

You should configure Nginx to use the plain HTTP protocol to connect to port 9980.

http://127.0.0.1:9980

For HAProxy Users

HAProxy is a high-performance reverse proxy. If you use HAProxy on your server, you might have additional problems.

If Nextcloud tells you that it could not establish connection to the Collabora Online server, it might be that your Nginx server is running behind a reverse proxy like HAProxy and you have the following two lines in the /etc/nginx/nginx.conf.

set_real_ip_from 127.0.0.1;
real_ip_header proxy_protocol;

This means that Nginx expects HTTP connection from the reverse proxy. You should edit the /etc/nginx/conf.d/collaboara.conf file and add proxy_protocol to the listen directive.

listen 127.0.0.1:443 ssl http2 proxy_protocol;

Then edit the /etc/hosts file and add a static DNS record like below. Repalce 12.34.56.78 with the public IP address of the server.

12.34.56.78          collaboara.example.com

collabora.example.com should be pointed to the public IP address of your server. Don’t point it to 127.0.0.1.

How to Update Collabora Online

Simply run sudo apt update and sudo apt upgrade to update collabora online. During the update process, you might be asked if you want to use the new coolwsd.xml config file.

coolwsd update

If you choose Yes, then you need to follow step 2 again to re-configure Collabora Online WebSocket Daemon.

Wrapping Up

That’s it! I hope this tutorial helped you install, run Collabora Online on Ubuntu 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 Twitter or like our Facebook page. Take care 🙂

Rate this tutorial
[Total: 18 Average: 5]

63 Responses to “Integrate Collabora Online with Nextcloud on Ubuntu without Docker

  • Michael
    4 years ago

    That is so cool, thank you for sharing that!

  • Works perfectly! Thank you!

  • Hi Linuxbabe

    Thanks for the info.

    Do you have a config to install nextcloud and Collabora office on the same server, with no docker.

    Tx in Advance

    Johan

    • Xiao Guoan (Admin)
      4 years ago

      This article is for integrating Nextcloud and Collabora without Docker and it works when Nextcloud and Collabora run on the same server.

      • Hi Xiao Guoan and firstly thanks for your guide.
        I would ask you if is it possibile to show the Letsencrypt enabled virtualhost config content.

        Thanks again!

        Davide

        • Xiao Guoan (Admin)
          2 years ago

          If you use Nginx, then Let’s Encrypt client (certbot) automatically re-configure the Nginx virtual host file (/etc/nginx/conf.d/collabora.conf) to support TLS.

          If you use Apache, then Let’s Encrypt client (certbot) automatically create an SSL virtual host file (/etc/apache2/sites-enabled/collabora-le-ssl.conf).

  • Quang Mai
    4 years ago

    Hi Xiao,

    Thanks for this article instruction. I have a question about integrating Nextcloud and Collabora run on the same server.
    Let’s say I have 1 static IP: 111.222.333.444 points to cloud.domain.com.
    So if we install Collabora on the same server which means 111.222.333.444, how do we set up the A record for DNS which will point collabora.domain.com to the same IP address: 111.222.333.444? Is there any conflict between these?

    Once again, thank you very much for this.
    Kind regards,
    Quang

    • Xiao Guoan (Admin)
      4 years ago

      No. There won’t be any conflict. An IP address can serve multiple domains/sub-domains. This is known as virtual hosting.

  • Hi,

    I’ve got Nextcloud 18.0.6 and the last version (4.2.4) of Collabora – CODE running on the same server and it really works fine.

    Nevertheless, there is only the english dictionary installed. Can you tell me how to install another dictionary ?

    Thanks for your help.

    Freddy

    • Francesc Ortiz
      4 years ago

      I have the same problem, I need to install another lenguage, but I try differents ways and tutorials and nothing happened, always show english dict. alone.

  • Andrew Wilson
    4 years ago

    Totally AWESOME instructions. Worked first time!

    I set this up in an lxc ubuntu 18.04 container running on an ubuntu 20.04 server. It connected with my lxc Nextcloud container (running on the same server). I setup my domain names, run the certbot, fixed a type (my bad…) and it just WORKED!

    You are friggin AWESOME!!! Thank you very much. 🙂

  • Muqtadir Kamal
    4 years ago

    Hi,
    I already i was installed locally system, i don’t have and DNS name, i m using oracle vm virtualbox , everything i was install successfully only stack in edit online doucment “Integrate Collabora Online” , what i have to enter ? “Use you own server URL (and Port) of Collabora Online-server” and i am able open the “Collabora Online admin panal” “loleaflet/dist/admin/admin.html”

    Kindly help this regards

    • Xiao Guoan (Admin)
      4 years ago

      Nextcloud requires you to use https connection with Collabora. If you don’t want to spend money on a domain name, you can just use LibreOffice on your Linux desktop, and don’t use Collabora Online.

      I would recommend buying a domain name (which can be as low as $1.37/year), if you really want to tinker with server software

  • Michael
    4 years ago

    Thanks for the great tutorial – what would I have to change if I installed Collabora and Nextcloud on 2 different hosts?
    The admin interface of Collabora already answers me externally.
    I use different external addresses for Nextcloud and Collabora 2.
    The Collabora service works too! The Request: https://localhost:8890 – gives the answer: OK
    After adding it to Nextcloud, I get the error: “Could not connect to the Collabora Online server.”I think a problem with the proxy?

  • ThumbOne
    4 years ago

    Thanks for this brilliant guide. I love it! I have Nexcloud and Collabora on the one box now. But I use lighttpd and it doesn’t work.

    When I point Nextcloud to the Collabora URL under: URL (and Port) of Collabora Online-server as you have and click Save it reports “Could not establish connection to the Collabora Online server.”

    I see nothing in the Nextcloud log. So what I’m wondering is how, further to diagnose this. I tried simply testing some of he configured URLS. For example on the WPI discovery URL, I do see a beautiful page which lets me discover the WOPI services. Nice. It’s a rich JS driven page. On the WOPI capabilities URL, I get lovely terse response which renders in raw format as: {“convert-to”:{“available”:true},”hasMobileSupport”:true,”hasProxyPrefix”:false,”hasTemplateSaveAs”:false,”hasTemplateSource”:true,”productName”:”Collabora Online Development Edition”,”productVersion”:”4.2.6″,”productVersionHash”:”ed4f732″}.

    On the Admin console URL alas I get no response, the browser just sits and whirs waiting. That is not encouraging.

    I am wondering what does Nextcloud test to see that the server is active? And what diagnostic tips might you provide? Be mighty appreciative for any tips.

    What do you see if you navigate to https:collaboraserver.tld/lool/adminws? I don’t get a response alas. And would love to know if I should expect one and if so, what and how to diagnose why its not there.

    There is but one subtle difference between all the web server configs listed, they all reverse proxy to localhost:9980, but the admin console and main websocket have an Upgrade header set. I wonder if something there went wrong and how to find out if it did. I use lighttpd, and its mod_proxy: https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModProxy, it’s comparable syntax seems to be proxy.header = ( “upgrade” => “enable” ).

    The trick is understanding what this upgrade command does in Apache, and in Nginx.

  • Thanks for the great tutorial. I already i was installed locally system, i don’t have and DNS name, i m using oracle vm virtualbox , everything i was install successfully only stack in edit online doucment “Integrate Collabora Online” , but when i edit doc files, always like this, hopefully i have the solutions from here

    • Xiao Guoan (Admin)
      4 years ago

      I would recommend buying a domain name (which can be as low as $1.37/year), if you really want to tinker with server software.

  • Hi, I have installed nextcloud with LAMP stack on ubuntu 20.04 on LXC container in Proxmox. Nextcloud is working great using haproxy under Pfsense but I cannot get Collabora to work using Apache. I saw you post if I installed it using nginx, should I delete apache to install nginx?

    Is there a way to get apache to work using haproxy also, if so how?

    Thanks

  • This is a wonderful guide! Thank you! Do you know if there is any way to allow two domains to connect to the CODE server? I tried several things, but have only been able to get one at a time to work.

  • Michael
    3 years ago

    Thank you very much, you’re awesome.

  • Thank you for the amazing tutorials for both NextCloud and Collabora.
    I’ve installed both on Ubuntu 20.04 in digitalOcean
    Nextcloud works fine but when I try to open a docx document the nextcloud can’t reach the server and stays stuck at0% during the connection.
    In the parameters, everything seems to be fine, I don’t understand…

    • Xiao Guoan (Admin)
      2 years ago

      Hello Dave, I just updated this tutorial.

      Firefox has problems trying to load .docx files in Nextcloud. You can use Google Chrome.

  • duffman
    3 years ago

    Great instructions LinuxBabe!!! i was running docker and was able to switch to native with these instructions!

    Happy Installs!!!

  • Xiao, do you know OxOffice Online?
    It works smoother than Collabora Online

    https://docs.ossii.com.tw/books/oxoffice-online-technical-manual

  • Hey there, I recently tried to install the Collabora-Server step by step.
    Everything went smooth. Even If I open the subdomain where the Server is pointing, it gives me a “OK” back. Even more the Nextcloud Admin panel tell that it can reach the office Server. (see screenshots)

    But the time I try to open or create a Document it says “Document loading failed”

    The Collabora Errorlog outputs the following:

    [error] 44569#44569: *800 open() "/usr/share/nginx/html/browser/1e92cc5/cool.html" failed (2: No such file or directory), client: 10.59.226.1, server: office.next.htb, request: "POST /browser/1e92cc5/cool.html?WOPISrc=http%3A%2F%2Fnext.htb%2Fnextcloud%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F259_oc3fgu6buwj7&title=test.odt&lang=de&closebutton=1&revisionhistory=1 HTTP/1.1", host: "office.next.htb", referrer: "http://next.htb/"

    Does somebody know whats going on there and how to fix it?

    THX
    Jacky

    • Pedro Souza
      3 years ago

      To correct this error:

      [error] 44569#44569: *800 open() "/usr/share/nginx/html/browser/1e92cc5/cool.html

      On new versions of Collabora change Nginx proxy lines:

      location ^~ /loleaflet

      to

      location ^~ /browser

      And lines

      location ~ ^/lool

      to

      location ~ ^/cool

      Don’t forget to restart Nginx.

    • Abongile
      2 years ago

      Hi There, same problem; “Document loading failed” and admin is blank. Is there something missing like an index.html file /var/www/*, how does one resolve the issue? Thanks again.

  • dysonsphere
    3 years ago

    is there any advantage to running Collabora this was vs using the Docker install?

    • Xiao Guoan (Admin)
      2 years ago

      Docker is clumsy. Running Collabora without Docker is resource-efficient.

  • Thanks for all your job, I already did my mail server without any problem.
    After I thinks some change happened because I must replace lool my cool for all the installation.
    But at the end I can’t open admin console or a file.
    I got a blank screen on admin panel and when I open a file I got “document loading failed”.

    On my debian syslog I got:

    Apr 11 10:20:06 ns394665 coolwsd[643981]: wsd-643981-644001 2022-04-11 10:20:06.832040 +0000 [ websrv_poll ] WRN  convert-to: Requesting address is denied: XXX.XXX.XXX.XXX| wsd/COOLWSD.cpp:3015
  • Bernieo
    2 years ago

    Hi this is really good and still relevant today. Is there any chance you can make it perfect for me by adding an entry for HAProxy?

    • Bernieo
      2 years ago

      2x nextcloud vm’s, 1x CollaboraOffice vm with Apache2 virtualhost, all on Proxmox routing through pfsense vm with haproxy module installed. All vms access internet okay and can access ACME directly. but I need fornt and backend configs to allow nexcloud 1&2 to access the Collabora vm.

      Any pointers would be appreciated

  • Duffman
    2 years ago

    –To add MS Office fonts to Collabora–

    1. sudo apt install ttf-mscorefont-installer
    2. sudo fc-cache -f -v
    3. sudo coolconfig update-system-template
    4. sudo systemctl restart coolwsd
    5. sudo systemctl restart php7.4-fpm
    6. sudo systemctl restart nginx

    • Xiao Guoan (Admin)
      2 years ago

      You can restart 3 services in one command 🙂

      sudo systemctl restart coolwsd php7.4-fpm nginx
  • Vanessa M Pires
    2 years ago

    It’s working like a charm. Thanks!

  • brook kelly
    2 years ago

    Thank you very much for sharing an informative blog with the installation processes in such detail. I am very happy about your patience and willingness to help make this installation with such detail and dexterity. Greetings from the United Kingdom to you! Very successful !!! and you know about this logo design?? https://www.logosymmetry.co.uk/

  • Gerald Kelso
    2 years ago

    Thank you for the very concise and helpful guide. I’ve spent quite a while trying to get Collabora working to no avail. Even the built-in CODE server refused to function.

  • Keith Friend
    2 years ago

    Hi Linuxbabe,
    I have received an error at step two, that coolwsd is not available.
    I have also received a warning in step one that apt-key is deprecated.
    Recent Ubuntu 22.04 version on Raspberry pi4 installed as per your excellent documentation.

    ubuntu@ubuntu:~$ sudo apt update
    Hit:1 http://ports.ubuntu.com/ubuntu-ports jammy InRelease
    Get:2 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease [109 kB]
    Get:3 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease [99.8 kB]
    Get:4 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease [110 kB]
    Get:5 https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-ubuntu2204 ./ InRelease [1728 B]
    Get:6 https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-ubuntu2204 ./ Packages [24.1 kB]
    Fetched 345 kB in 4s (91.7 kB/s)
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    All packages are up to date.
    W: https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-ubuntu2204/./InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
    
    ubuntu@ubuntu:~$ sudo apt install coolwsd code-brand
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    Package coolwsd is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    
    E: Package 'coolwsd' has no installation candidate
    ubuntu@ubuntu:~$
    

    Thanks for any assistance you can give. It is appreciated.

  • Marcio Almeida
    2 years ago

    Hi Xiao
    Your tutorial helped a lot.
    But I get a connection error when trying to create a file on nextcloud (see the file with attached images)
    Thank you for the help
    Marcio

  • Hi Xiao,

    Great post as usual. Just an update though.

    Setting the wopi host appears to break the integration with the latest CODE server release re:

    sudo coolconfig set storage.wopi.host nextcloud.example.com

    Removing the above entry in the XML file fixes it

  • Keith Friend
    2 years ago

    Hi Xiao,
    Thanks for another great guide. Worked a treat after some small issues..
    Just an update, the “Nextcloud Office” suite is no longer available for version 24.0.0, just use the Collabora onbline app instead.

  • nobby shimada
    2 years ago

    Hi Mr. Xiao,

    I recently updated 2 servers in vps, one is deployed nextcloud and the other deployed coolwsd and related tools.
    Just after such updates, I have encountered a trouble which does not allow opening office documents(except pdf, md) by using my own coolwsd server(not by container).
    Following is a message from nextcloud server(Ubuntu20.04):

    [proxy_fcgi:error] [pid 1801] [client xxx.xxx.xx.xxx:28886] AH01071: Got error 'PHP message: richdocumentscode (proxy.php) error exit, PID: 1802, Message: No content in reply from coolwsd. Is SSL enabled in error ?' nextcloud version is 24.0.1.

    And following is an error message from coolwsd server(Ubuntu20.04, not by container):

    [authz_core:error] [pid 2672:tid 139998972057344] [client xx.xxx.xxx.xxx:36192] AH01630: client denied by server configuration: /var/www/html/server-status

    Meanwhile opening office documents by using built-in code is fine.

    Wish to have comment soon,

    nobby

    • dsyates
      2 years ago

      I am having the exact same issue

    • As no feedback obtained, I have removed and reinstalled coolwsd and it now works again.
      In the future I hesitate to upgrade coolwsd and nexcloud as it may cause trouble again.

  • Jong Hoon LEE
    2 years ago

    Is it not working on Nextcloud 24.0.2 ?
    I have messaged,

    sudo journalctl -eu coolwsd

    [ websrv_poll ] WRN client – server version mismatch, disabling browser cache. Expected: b15c462| wsd/FileServer.cpp:510
    JWTAuth: verification failed; Expected: o3z7gRPxmDnfVo55RitEky61qikhjSMFAJMvCfy1LeSPCfMnZbS8Ncx9fDNV0SMn1NEiQoZogb0tqpmZLCK5fEHnXLAAEXB4FxNQWKSQeaslOg-EWz

    Do I need to go nextcloud 24.0.0 ?
    Could you give me a way to solve it?

  • Hello Xiao, many thanks for your tutorial which is a delight as usual. I did it 3 times and it worked like a charm but with my last try, i can’t make it work, here is where the problem should be i presume but i can’t figure out why:

    juin 26 21:37:51 nextcloudsrv coolwsd[32316]: wsd-32316-32344 2022-06-26 21:37:51.941886 +0000 [ docbroker_001 ] ERR  No acceptable WOPI hosts found matching the target host [kamino.bruleuraem.fr] in config.| wsd/Storage.cpp:259
    juin 26 21:37:51 nextcloudsrv coolwsd[32316]: wsd-32316-32344 2022-06-26 21:37:51.942025 +0000 [ docbroker_001 ] ERR  loading document exception: No acceptable WOPI hosts found matching the target host [kamino.bruleuraem.fr] in config.|>
    juin 26 21:37:51 nextcloudsrv coolwsd[32316]: wsd-32316-32344 2022-06-26 21:37:51.942049 +0000 [ docbroker_001 ] ERR  Failed to add session to [https://kamino.bruleuraem.fr:443/index.php/apps/richdocuments/wopi/files/12500_ocjb21hwwktv]>
    juin 26 21:37:51 nextcloudsrv coolwsd[32316]: wsd-32316-32344 2022-06-26 21:37:51.942074 +0000 [ docbroker_001 ] ERR  Unauthorized Request while starting session on https://kamino.bruleuraem.fr:443/index.php/apps/richdocuments/wopi/file>
    juin 26 21:37:51 nextcloudsrv coolwsd[32316]: wsd-32316-32344 2022-06-26 21:37:51.942400 +0000 [ docbroker_001 ] ERR  #25: Socket write returned -1 (EPIPE: Broken pipe)| net/Socket.hpp:1425
    juin 26 21:37:51 nextcloudsrv coolwsd[32316]: wsd-32316-32344 2022-06-26 21:37:51.942429 +0000 [ docbroker_001 ] ERR  Invalid or unknown session [002] to remove.| wsd/DocumentBroker.cpp:2261
    juin 26 21:37:52 nextcloudsrv coolwsd[32316]: wsd-32316-32341 2022-06-26 21:37:52.241105 +0000 [ websrv_poll ] WRN  DocBroker with docKey [https://kamino.bruleuraem.fr:443/index.php/apps/richdocuments/wopi/files/12500_ocjb21hwwktv] is u>
    juin 26 21:37:52 nextcloudsrv coolwsd[32316]: wsd-32316-32341 2022-06-26 21:37:52.241221 +0000 [ websrv_poll ] ERR  Error while handling Client WS Request: Failed to create DocBroker with docKey [https://kamino.bruleuraem.fr:443/index.p>
    juin 26 21:37:52 nextcloudsrv coolwsd[32316]: wsd-32316-32341 2022-06-26 21:37:52.241263 +0000 [ websrv_poll ] ERR  #29: Socket write returned -1 (EPIPE: Broken pipe)| net/Socket.hpp:1425
    juin 26 21:37:52 nextcloudsrv coolwsd[32316]: wsd-32316-32341 2022-06-26 21:37:52.241285 +0000 [ websrv_poll ] ERR  #29: Socket write returned -1 (EPIPE: Broken pipe)| net/Socket.hpp:1425
    juin 26 21:37:52 nextcloudsrv coolwsd[32316]: wsd-32316-32341 2022-06-26 21:37:52.241294 +0000 [ websrv_poll ] WRN  #29 is shutting down but 64 bytes couldn't be flushed and still remain in the output buffer.| net/WebSocketHandler.hpp:7>
    juin 26 21:37:52 nextcloudsrv coolwsd[32316]: wsd-32316-32341 2022-06-26 21:37:52.241322 +0000 [ websrv_poll ] ERR  #29: attempted to remove: 903 which is > size: 0 clamped to 0| net/Socket.hpp:1226
    juin 26 21:37:52 nextcloudsrv coolwsd[32316]: wsd-32316-32341 2022-06-26 21:37:52.241337 +0000 [ websrv_poll ] ERR  #29: Socket write returned -1 (EPIPE: Broken pipe)| net/Socket.hpp:1425
    juin 26 21:37:52 nextcloudsrv coolwsd[32316]: wsd-32316-32341 2022-06-26 21:37:52.503189 +0000 [ websrv_poll ] WRN  DocBroker with docKey [https://kamino.bruleuraem.fr:443/index.php/apps/richdocuments/wopi/files/12500_ocjb21hwwktv] is u>
    juin 26 21:37:52 nextcloudsrv coolwsd[32316]: wsd-32316-32341 2022-06-26 21:37:52.503406 +0000 [ websrv_poll ] ERR  Error while handling Client WS Request: Failed to create DocBroker with docKey [https://kamino.bruleuraem.fr:443/index.p>
    juin 26 21:37:52 nextcloudsrv coolwsd[32316]: wsd-32316-32341 2022-06-26 21:37:52.503446 +0000 [ websrv_poll ] ERR  #29: Socket write returned -1 (EPIPE: Broken pipe)| net/Socket.hpp:1425
    juin 26 21:37:52 nextcloudsrv coolwsd[32316]: wsd-32316-32341 2022-06-26 21:37:52.503466 +0000 [ websrv_poll ] ERR  #29: Socket write returned -1 (EPIPE: Broken pipe)| net/Socket.hpp:1425
    juin 26 21:37:52 nextcloudsrv coolwsd[32316]: wsd-32316-32341 2022-06-26 21:37:52.503475 +0000 [ websrv_poll ] WRN  #29 is shutting down but 64 bytes couldn't be flushed and still remain in the output buffer.| net/WebSocketHandler.hpp:7>
    juin 26 21:37:52 nextcloudsrv coolwsd[32316]: wsd-32316-32341 2022-06-26 21:37:52.503489 +0000 [ websrv_poll ] ERR  #29: attempted to remove: 903 which is > size: 0 clamped to 0| net/Socket.hpp:1226
    juin 26 21:37:52 nextcloudsrv coolwsd[32316]: wsd-32316-32341 2022-06-26 21:37:52.503504 +0000 [ websrv_poll ] ERR  #29: Socket write returned -1 (EPIPE: Broken pipe)| net/Socket.hpp:1425
    juin 26 21:37:53 nextcloudsrv coolwsd[32316]: wsd-32316-32326 2022-06-26 21:37:53.942852 +0000 [ prisoner_poll ] WRN  Prisoner connection disconnected but without valid socket.| wsd/COOLWSD.cpp:3079
    juin 26 21:37:53 nextcloudsrv coolwsd[32316]: wsd-32316-32326 2022-06-26 21:37:53.943459 +0000 [ prisoner_poll ] WRN  Prisoner connection disconnected but without valid socket.| wsd/COOLWSD.cpp:3079
    juin 26 21:37:54 nextcloudsrv coolwsd[32316]: wsd-32316-32356 2022-06-26 21:37:54.529316 +0000 [ docbroker_002 ] ERR  No acceptable WOPI hosts found matching the target host [kamino.bruleuraem.fr] in config.| wsd/Storage.cpp:259
    juin 26 21:37:54 nextcloudsrv coolwsd[32316]: wsd-32316-32356 2022-06-26 21:37:54.529421 +0000 [ docbroker_002 ] ERR  loading document exception: No acceptable WOPI hosts found matching the target host [kamino.bruleuraem.fr] in config.|>
    juin 26 21:37:54 nextcloudsrv coolwsd[32316]: wsd-32316-32356 2022-06-26 21:37:54.529445 +0000 [ docbroker_002 ] ERR  Failed to add session to [https://kamino.bruleuraem.fr:443/index.php/apps/richdocuments/wopi/files/12500_ocjb21hwwktv]>
    juin 26 21:37:54 nextcloudsrv coolwsd[32316]: wsd-32316-32356 2022-06-26 21:37:54.529468 +0000 [ docbroker_002 ] ERR  Unauthorized Request while starting session on https://kamino.bruleuraem.fr:443/index.php/apps/richdocuments/wopi/file>
    juin 26 21:37:54 nextcloudsrv coolwsd[32316]: wsd-32316-32356 2022-06-26 21:37:54.529566 +0000 [ docbroker_002 ] ERR  #19: Socket write returned -1 (EPIPE: Broken pipe)| net/Socket.hpp:1425
    juin 26 21:37:54 nextcloudsrv coolwsd[32316]: wsd-32316-32356 2022-06-26 21:37:54.529589 +0000 [ docbroker_002 ] ERR  Invalid or unknown session [005] to remove.| wsd/DocumentBroker.cpp:2261
    juin 26 21:37:56 nextcloudsrv coolwsd[32316]: wsd-32316-32326 2022-06-26 21:37:56.530003 +0000 [ prisoner_poll ] WRN  Prisoner connection disconnected but without valid socket.| wsd/COOLWSD.cpp:3079
    juin 26 21:37:56 nextcloudsrv coolwsd[32316]: wsd-32316-32326 2022-06-26 21:37:56.530061 +0000 [ prisoner_poll ] WRN  Prisoner connection disconnected but without valid socket.| wsd/COOLWSD.cpp:3079
    

    Hope you could help

    • Haha, i posted too fast and can’t unpost,sorry for the long outpout…

  • I can confirm that although I had Collabora Online (or Nextcloud Office, or whatever it’s being called) working on Nextcloud 24, updates installed on an Ubuntu 20.04 server today broke things… For a start, the updates deleted the certificate in /etc/coolwsd, and the coolwsd daemon was no longer working after (not even after I provided another certificate and configured it in /etc/coolwsd/coolwld.xml).

    Please could you troubleshoot, and then review and update the article? We’d all be so grateful! 🙂

    Also, could you give information about what server headers can and cannot be included in the Nginx config of Collabora and of Nexcloud for Collabora to work properly?

    Thanks so much for your many how-to’s … they really are a precious resource for the Linux community! 🙂

    • Xiao Guoan (Admin)
      2 years ago

      Simply follow step 2 again to re-configure Collabora Online WebSocket Daemon.

      There’s no point enabling TLS in /etc/coolwsd/coolwsd.xml file. TLS is already enabled in the Apache/Nginx collabora.conf virtual host.

      • Actually, before you replied, I tried completely purging the packages coolwsd and code-brand from my system, including removing the /etc/coolwsd directory (which was left undeleted because not empty). Then I completely re-followed your installation instructions.

        In the Nextcloud Settings/Administration/Nextcloud Office tab, Nextcloud seems to see my Collabora Online server just fine (it’s installed on a subdomain of the domain hosting my Nextcloud.

        The Collabora Online admin panel is reachable as well. I enabled coolwsd logging into /var/log/coolwsd.log but the log contains no apparent error messages.

        The command ‘journalctl -eu coolwasd’ shows no error messages and reports coolwsd as listening on port 0.0.0.0:9980

        So everything *looks* good, but when I try to open a document, loading fails. When I look at the logs in the Collabora Online admin panel, I have the output below (see the attached screenshot).

        When purging Collabora, the only thing I did not change was the Nginx conf for the Nextcloud instance and the Nginx config for the Collabora Online instance…

        I’m wondering whether that’s where the problem is….

        When I had Collabora Online working before, clicking on a document produced a lot more apparent interaction between the two vhosts (as seen in the bottom-left corner of Firefox….
        Now, interaction starts but seems to halt much earlier, and /var/log/nginx/collabora.error contains the following lines for the minute at which I attempted to load the document:

        2022/07/02 18:59:36 [error] 379649#379649: *2233 connect() failed (111: Connection refused) while connecting to upstream, client: 88.198.1.89, server: code.example.com, request: "GET /hosting/capabilities HTTP/1.1", upstream: "http://127.0.0.1:9980/hosting/capabilities", host: "code.example.com"
        2022/07/02 19:00:41 [error] 379649#379649: *2440 connect() failed (111: Connection refused) while connecting to upstream, client: 88.198.1.89, server: code.example.com, request: "GET /hosting/capabilities HTTP/1.1", upstream: "http://127.0.0.1:9980/hosting/capabilities", host: "code.example.com"
        2022/07/02 19:01:42 [error] 379649#379649: *2675 connect() failed (111: Connection refused) while connecting to upstream, client: 88.198.1.89, server: code.example.com, request: "GET /hosting/capabilities HTTP/1.1", upstream: "http://127.0.0.1:9980/hosting/capabilities", host: "code.example.com"
        2022/07/02 19:04:15 [error] 1220#1220: *252 connect() failed (111: Connection refused) while connecting to upstream, client: 88.198.1.89, server: code.example.com, request: "GET /hosting/capabilities HTTP/1.1", upstream: "http://127.0.0.1:9980/hosting/capabilities", host: "code.example.com"
        

        code.example.com is the Collabora Online vhost and the Nextcloud instance is therefore on example.com (obviously I obfuscated the real domain name, but you can see it in the screenshot)… I am totally stuck here… if you reply, I can post the 2 Nginx vhost conf files if you want….

        Got any ideas?

    • Xiao Guoan (Admin)
      2 years ago

      Maybe you should edit the /etc/hosts file. Make sure your Nextcloud sub-domain resolves to the same IP address that the Nginx virtual host listens on.

      If your /etc/hosts file looks like this:

      127.0.0.1   localhost focal ubuntu nextcloud.example.com collabora.example.com

      But your Nginx virtual host file is configured to listen on another IP address.

      listen 12.34.56.78:443 ssl http2;

      Then you have a problem.

      • Brilliant thinking, Xiao! It worked. For other people busting their heads over the same problem, I altered my /etc/hosts file to look something like the following:

        127.0.0.1 mail.example.com localhost.localdomain localhost
        888.999.222.111 mail.example.com
        123.444.555.666 example.com code.example.com
        444.666.888.999 somotherexample.com
        

        I put ‘mail.example.com’ (in addition to localhost.localdomain and localhost) on 127.0.0.1 because I have a mail server running on the Linux server.

        I put ‘mail.example.com’ on 888.999.222.111 because that is the public IP address on which the mail server is published in DNS, and a reverse lookup must find your mail server on that address if you want your mail server to have good reputation (in addition, lots of other measures implemented – check out Xiao’s other great Linuxbabe how-to’s on mail server configuration).

        I put ‘example.com’ (my Nextcloud instance) and ‘code.example.com’ (my Collabora Online instance) on 123.444.555.666 to concur with their published locations in DNS. This is what fixed my problem.

        ‘someotherexample.com’ on 444.666.888.999 is just some other domain that I added, in case other readers are also hosting other domains on their server.

        Obviously, ‘example.com’ and ‘someotherexample.com’ are to be replaced with your real-life domains, and the above IP addresses are to be replaced with your actual real-life IPv4 addresses.
        If you also have IPv6 addresses to publish, you can put them after the above configuration.

        Thank you so much for your valuable expertise, Xiao – I will be sending you a $10 cup of coffee with my heartfelt thanks! 🙂

  • mr.kev
    1 year ago

    Is there a way to install coolwsd on wsl2? I have installed succesfully but wsl doesnt have systemd and coolwsd service cannot be found. Thanks

  • Kevin Connolly
    1 year ago

    Good Day
    Not sure where to start. I did this sometime ago so please excuse me if I don’t remember how I did it (I’m 66 and that happens sometimes. Ha) I have the built in code server installed and Nextcloud office. I don’t think I did anything else in your guide. For instance, if I run systenctl status coolwsd there is no package for that. Admin setting is set to use built in CODE server. It kind of works. Throws errors though trying to resolve cloud.example.com (not sure where or what config file cloud.example.com is specified)
    The overall topology is my Nextcloud server sits behind a reverse proxy server. The reason for this is because my Nextcloud data is mirrored to a remote NAS via Wireguard.
    I’m using Nginx on all machines.
    So the question is: If I follow your guide will it work or just hose my machine?…and why does it kinda sorta work now and is there a way to just build on that?

    • Kevin Connolly
      1 year ago

      I’m actually worried that if I tried to add the CODE server per your tutorial that it’d conflict with what’s already (whatever that is) and totally hose things for sure.

  • MRTS67
    1 year ago

    Good job, it worked on the first try

  • I got this error :

    [Wed Oct 18 08:44:52.875152 2023] [ssl:error] [pid 25118:tid 140280288224832] [client X.X.X.X:54330] AH02032: Hostname xxxx.com provided via SNI and hostname xxx.com provided via HTTP have no compatible SSL setup

  • Thank you, very much
    Ubuntu server 22.04 and Nextcloud 27.1

  • Peter Plett
    8 months ago

    I get this error
    nginx -t
    nginx: [warn] protocol options redefined for [::]:443 in /etc/nginx/conf.d/ds.conf:9
    nginx: [warn] protocol options redefined for 0.0.0.0:443 in /etc/nginx/conf.d/ds.conf:10
    nginx: [warn] conflicting server name “collabora.XXXX.XX” on [::]:443, ignored
    nginx: [warn] conflicting server name “collabora.XXXX.XX” on 0.0.0.0:443, ignored
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful

  • Honestly amazing guide, I wish you did one for only-office, every guide out there either don’t work or works to some degree with docker and its not always the best to use docker.

  • I had an issue when importing some machine from a backup towards a newly installed Proxmox vHost. Turned out that I must have had IPv6 activated in my old vHost but deactivated in my new one. Therefore it worked on the old but kept failing to start the daemon.

    # systemctl status coolwsd
    × coolwsd.service - Collabora Online WebSocket Daemon
         Loaded: loaded (/lib/systemd/system/coolwsd.service; enabled; vendor preset: enabled)
         Active: failed (Result: exit-code) since Mon 2024-08-26 23:20:26 UTC; 1s ago
        Process: 12864 ExecStart=/usr/bin/coolwsd --version --o:sys_template_path=/opt/cool/systemplate --o:child_root_path=/opt/cool/child>
       Main PID: 12864 (code=exited, status=70)
            CPU: 2.094s
    
    Aug 26 23:20:26 office systemd[1]: coolwsd.service: Scheduled restart job, restart counter is at 5.
    Aug 26 23:20:26 office systemd[1]: Stopped Collabora Online WebSocket Daemon.
    Aug 26 23:20:26 office systemd[1]: coolwsd.service: Consumed 2.094s CPU time.
    Aug 26 23:20:26 office systemd[1]: coolwsd.service: Start request repeated too quickly.
    Aug 26 23:20:26 office systemd[1]: coolwsd.service: Failed with result 'exit-code'.
    Aug 26 23:20:26 office systemd[1]: Failed to start Collabora Online WebSocket Daemon.
    

    After digging a while in the error log that’s what led me to the solution…

    # journalctl -eu coolwsd
    [...]
    Aug 26 23:20:26 office coolwsd[12864]: wsd-12864-12864 2024-08-26 23:20:26.288934 +0000 [ coolwsd ] ERR  #-1: Failed to bind to: IPv6 port: 9980 (EBADF: Bad file descriptor)| net/Socket.cpp:1046
    [...]
    Aug 26 23:20:26 office coolwsd[12864]: wsd-12864-12864 2024-08-26 23:20:26.288969 +0000 [ coolwsd ] FTL  Failed to listen on Server port(s) (9980-9980). Exiting| wsd/COOLWSD.cpp:4227
    [...]
    Aug 26 23:20:26 office systemd[1]: Failed to start Collabora Online WebSocket Daemon.
    

    And then it was rather easy to find a proper suggestion: https://help.nextcloud.com/t/collabora-online-loolwsd-err-failed-to-bind-to-ipv6-port/30258

    It needs to be that way:

    # grep "Protocol to use IPv4, IPv6 or all for both" /etc/coolwsd/coolwsd.xml
    		IPv4
    

    Then the daemon started properly.

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here