Integrating Collabora Online with NextCloud

Well, In this document, I wanted to show how to integrate Collabora into Nextcloud, Anyone doesn't know Collabora? Can you imagine having your own Google Docs? or your Office 365? It would be great, No? Well, Collabora will allow us to do the same but completely free of charge, all based on LibreOffice. We will be able to edit office documents online and work collaboratively!

 

Collabora00-Bujarra

This document will not only achieve that, but we will integrate it into a machine with Nextcloud that we already have the environment. Being able to have our private cloud, storing our data in our own data center, now we will be able to allow users to work with Office documents online, that they edit them from the browser itself, and also multiple users can work at the same time with the same documents!

By relying on LibreOffice, By the way,, Get to know the new version, No? It's impressive, since they parted ways with OpenOffice… Well, As I said, The documents that we can edit online, they have, among others,, the following formats: DOC Documents, DOCX, ODF spreadsheets, XLS, XLSX, or PPT and PPTX presentations; in addition to viewing Visio files, Publisher.

 

Collabora000-Bujarra

 

Collabora Facility,

We'll be based on a Docker image that's already prepared as a container, that we can directly run in our environment. This document will be somewhat different, since we will copy from the container to the Nextcloud machine all the necessary files so that we do not have to run with Docker.

 

nextcloud-27-bujarra

First of all,, we install Docker using:

[SourceCode]Sudo apt-get update
sudo apt-get install docker.io[/SourceCode]

 

NextCloud-28-Bujarra

With the following commands, we will start as a Docker service, in addition to downloading and installing the image 'collabora/code’ from the repository, We will start it indicating the port (9980 x default) in addition to indicating the FQDN domain of the service. And we confirm at the end if it is started (We note the identifier of the container).

[SourceCode]sudo systemctl enable docker
sudo docker pull collabora/code
sudo docker run -t -d -p 127.0.0.1:9980:9980 -e ‘domain=datos.tundra-it.com’ –restart always –cap-add MKNOD collabora/code
Sudo Docker PS -a[/SourceCode]

 

nextcloud-29-bujarra

Copiamos los siguientes directorios y ficheros necesarios, posteriormente pararemos en contenedor recién descargado y lo borramos, ya no será necesario más.

[SourceCode]sudo docker cp 87ffdce147c8:/opt/collaboraoffice5.1/ /opt/
sudo docker cp 87ffdce147c8:/usr/bin/loolforkit /usr/bin/
sudo docker cp 87ffdce147c8:/usr/bin/loolmap /usr/bin/
sudo docker cp 87ffdce147c8:/usr/bin/loolmount /usr/bin/
sudo docker cp 87ffdce147c8:/usr/bin/looltool /usr/bin/
sudo docker cp 87ffdce147c8:/usr/bin/loolwsd /usr/bin/
sudo docker cp 87ffdce147c8:/usr/bin/loolwsd-systemplate-setup /usr/bin/
sudo docker cp 87ffdce147c8:/etc/loolwsd/ /etc/
sudo docker cp 87ffdce147c8:/usr/share/loolwsd/ /usr/share/
sudo docker cp 87ffdce147c8:/usr/lib/libPocoCrypto.so.45 /usr/lib/
sudo docker cp 87ffdce147c8:/usr/lib/libPocoFoundation.so.45 /usr/lib/
sudo docker cp 87ffdce147c8:/usr/lib/libPocoJSON.so.45 /usr/lib/
sudo docker cp 87ffdce147c8:/usr/lib/libPocoNet.so.45 /usr/lib/
sudo docker cp 87ffdce147c8:/usr/lib/libPocoNetSSL.so.45 /usr/lib/
sudo docker cp 87ffdce147c8:/usr/lib/libPocoUtil.so.45 /usr/lib/
sudo docker cp 87ffdce147c8:/usr/lib/libPocoXML.so.45 /usr/lib/

Sudo Docker Stop 87FFDCE147C8
Sudo Docker RM 87FFDCE147C8[/SourceCode]

 

nextcloud-30-bujarra

Next, We will have to install a valid certificate on our machine if we do not have it. The most comfortable thing in my case, I already have the PFX out there, so I copy it with WinSCP or similar and extract the certificate and private key, we put them in the corresponding directory. In addition, We must generate a file with the certificates of the intermediate and/or root issuing entities that we will export in base64, & We will paste the content of the certificates into this file.

[SourceCode]openSSL PKCS12 -in wildcard.tundra-it.com_2017.pfx -clcerts -nokeys -out wildcard.tundra-it.com_2017.cer
<pre>openssl pkcs12 -in wildcard.tundra-it.com_2017.pfx -nocerts -nodes -out wildcard.tundra-it.com_2017.key
sudo cp wildcard.tundra-it.com_2017.cer /etc/loolwsd/
sudo cp wildcard.tundra-it.com_2017.key /etc/loolwsd/
sudo vim /etc/loolwsd/ca_tundra.cer[/SourceCode]

nextcloud-31-bujarra

Editamos el fichero de configuración donde indicaremos el FQDN del sitio además del usuario y contraseña del administrador de Nextcloud.

[SourceCode]sudo vim /etc/loolwsd/loolwsd.xml

<host desc="Regex pattern of hostname to allow or deny." allow="true">datos.tundra-it.com</host>

<host desc="Hostname to allow" allow="false">datos.tundra-it.com</host>

<username desc="The username of the admin console. Must be set.">ncadmin</username>
<password desc="The password of the admin console. Must be set.">XXXXXXX</password>

<cert_file_path desc="Path to the cert file" relative="false">/etc/loolwsd/wildcard.tundra-it.com_2017.cer</cert_file_path>
<key_file_path desc="Path to the key file" relative="false">/etc/loolwsd/wildcard.tundra-it.com_2017.key</key_file_path>
<ca_file_path desc="Path to the ca file" relative="false">/etc/loolwsd/ca_tundra.cer</ca_file_path>[/SourceCode]

 

NextCloud-32-Bujarra

We also edit the file of the Apache secure site and enter the correct paths to the certificates:

[SourceCode]sudo vim /etc/apache2/sites-available/nextcloud_ssl_domain_self_signed.conf
SSLCertificateFile /etc/loolwsd/wildcard.tundra-it.com_2017.cer
SSLCertificateKeyFile /etc/loolwsd/wildcard.tundra-it.com_2017.key[/SourceCode]

 

NextCloud-33-Bujarra

GOOD, now it's time to install the Collabora Online Connector app, once logged in as a Nextcloud administrator, in Apps.

 

NextCloud-34-Bujarra

Once activated, since “Administration” > “Additional settings”, We will be able to find the correct URL in 'Collabora Online Server'’ HTTPS formatted://fqdn:9980

 

nextcloud-35-bujarra

GOOD, We created the user 'lool’ y realizamos correcciones de permisos, arrancamos la plantilla de sistema y creamos el servicio.

[SourceCode]sudo useradd lool
sudo setcap cap_fowner,cap_mknod,cap_sys_chroot=ep /usr/bin/loolforkit
sudo setcap cap_sys_admin=ep /usr/bin/loolmount
sudo mkdir /var/cache/loolwsd/
sudo mkdir /opt/lool/
sudo mkdir /opt/lool/child-roots/
sudo chown lool:lool /var/cache/loolwsd/ -R
sudo chown lool:lool /opt/lool/child-roots/ -R

sudo /usr/bin/loolwsd-systemplate-setup /opt/lool/systemplate /opt/collaboraoffice5.1/

sudo chown lool:lool /opt/lool/systemplate -R

sudo vim /etc/systemd/system/loolwsd.service[/SourceCode]

 

nextcloud-36-bujarra

Creamos el servicio ‘/etc/systemd/system/loolwsd.service’ with the following content:

[SourceCode]
[Unit]
Description=loolwsd as a service

[Service]
User=lool
ExecStart=/usr/bin/loolwsd –or:sys_template_path=/opt/lool/systemplate –or:lo_template_path=/opt/collaboraoffice5.1 –or:child_root_path=/opt/lool/child-roots –or:file_server_root_path=/usr/share/loolwsd
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target
[/SourceCode]

 

NextCloud-37-Bujarra

We enable the service and restart all services to reread the configurations, Later with 'sudo netstat -lnpt’ We will be able to verify that we have ports 443TCP and 9980TCP lifted.

[SourceCode]
sudo systemctl enable /etc/systemd/system/loolwsd.service
sudo systemctl daemon-reload
sudo systemctl start loolwsd.service
sudo systemctl restart apache2[/SourceCode]

 

NextCloud-38-Bujarra

We'll modify the '/etc/hosts’ Adding our external FQDN with local resolution.

 

nextcloud-39-bujarra

Last, we won't forget to remove Docker, since it will not be necessary and will also consume resources 😉

[SourceCode]Sudo apt-get remove docker.io[/SourceCode]

 

NextCloud-42B-Bujarra

And nothing, There's nothing left to do but try it! We will open our Nextcloud and any office file we have we can edit and work on it online. If we have it shared, In addition, we will simultaneously see which user is modifying which part of the document.

 

Recommended Posts

Author

nheobug@bujarra.com
Autor del blog Bujarra.com Cualquier necesidad que tengas, Do not hesitate to contact me, I will try to help you whenever I can, Sharing is living ;) . Enjoy documents!!!