Шаг 1. Установите Collabora Online на Ubuntu из официального репозитория. Collabora имеет официальный репозиторий пакетов для Ubuntu 22.04, 20.04 и 18.04. Выполните следующую команду, чтобы добавить его в вашу систему Ubuntu.
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 LibreOffice 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.
