Anda di halaman 1dari 17

How to Integrate

Collabora Online
Server with
Nextcloud on
Ubuntu 16.04
 Last Updated: November 17, 2018  Xiao Guoan
(Admin)  29 Comments  Cloud Storage

This tutorial is going to show you how to


install Collabora online server on Ubuntu
16.04 and then integrate it with an existing
Nextcloud server.

Collabora online is a self-hostable and


LibreOffice-based open source online office
suite. Its features includes:

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

Prerequisites

It’s assumed that you have already set up a


Nextcloud server which can be on any
Linux distribution. If you use Ubuntu 16.04
or Arch Linux, then you can check out the
following easy-to-understand guides.

How to set up Nextcloud on Ubuntu


16.04
How to set up Nextcloud on Arch
Linux

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 16.04 using a Docker image built
by Collabora and Nextcloud. Then
integrate it with an existing Nextcloud
server.

Step 1: Install Docker on


Ubuntu 16.04

If you want the latest Docker version, you


can install Docker from Docker’s APT
repository. For simplicity, this tutorial
install Docker from the default Ubuntu
software repository. Fire up a terminal
window ( CTRL+ALT+T ) and run the following
command to install Docker from Ubuntu
repository.

sudo apt update


sudo apt install docker.io
Once installed, the Docker daemon should
be automatically started. You can check its
status with:

systemctl status docker

If it’s not running, then start the daemon


with this command:

sudo systemctl start docker

And enable autostart at boot time:

sudo systemctl enable docker

Be default, Docker uses AUFS as the


storage driver on Debian and Ubuntu. In
order to make it work with Collabora
online office, you will need to switch to the
device mapper storage driver by following
the instructions below.

Create the following directory.

sudo mkdir /etc/systemd/system/do


cker.service.d

Create a new file under this directory.


sudo nano /etc/systemd/system/doc
ker.service.d/DeviceMapper.conf

Paste the following text into the file.

[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --stor
age-driver=devicemapper -H fd://

Save and close the file. Then reload


Systemd and restart Docker deamon.

sudo systemctl daemon-reload

sudo systemctl restart docker

Now issue the following command, you will


see that the storage driver in use is
devicemapper .

sudo docker info

Output:

Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 1
Server Version: 1.13.1
Storage Driver: devicemapper
Pool Name: docker-253:1-515579-p
ool

Step 2: Install and Run


Collabora Online Server
with Docker

Execute the following command to pull the


latest Collabora Online Development
Edition image from Docker hub.

sudo docker pull collabora/code

Then run this docker container.


Replace  nextcloud\\.your-domain\\.com
with your nextcloud server domain
(preserving backslash).

sudo docker run -t -d -p 127.0.0.


1:9980:9980 -e 'domain=nextclou
d\\.your-domain\\.com' --restart
always --cap-add MKNOD collabora/
code

The Collabora online server will be


listening on port 9980 of localhost
(127.0.0.1) as can be shown by issuing this
command:
sudo netstat -lnpt

Step 3: Set up Reverse


Proxy

Nextcloud server requires a TLS/SSL


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

First let us see how to do this with


Apache.

Set up Apache Virtual Host

Install Apache web server with the


following command:

sudo apt install apache2

Run the following command to create an


Apache virtual host file. Replace the
domain name with your actual domain
name for Collabora online server. Don’t
forget to create an A record for this domain
name.
sudo nano /etc/apache2/sites-avai
lable/office.your-domain.com.conf

Put the following text into the file.

<VirtualHost *:80>
ServerName office.your-domain.co
m
</VirtualHost>

Save and close the file. Enable this virtual


host with the following command:

sudo a2ensite office.your-domain.


com.conf

Then restart Apache.

sudo systemctl restart apache2

HTTPS helps us prevent man-in-the-middle


attack and password sniffing. We can
obtain a free TLS/SSL certificate from Let’s
Encrypt CA. First Let’s install the certbot
client. The client is still named  letsnecrypt
in Ubuntu repository. The following
command will install the client and apache
plugin.

sudo apt install letsencrypt pyth


on-letsencrypt-apache
Now issue the following command to obtain
a free TLS/SSL certificate. Replace the red-
colored text with your actual data.

sudo letsencrypt --apache --agree


-tos --email your-email-address -
d office.your-domain.com

You will be asked to choose easy or secure.


It’s recommended to choose secure so that
all http requests will be redirected to https.

Once you hit the OK button, a free TLS/SSL


certificate is obtained and installed on the
Apache virtual host.

Set up Apache Reverse Proxy

To be able to proxy traffic using Apache,


run the following commands to enable each
of these Apache modules.

sudo a2enmod proxy proxy_wstunnel


proxy_http ssl

Then run the following command to edit


the new virtual host file created by Let’s
Encrypt ( certbot ) client.

sudo nano /etc/apache2/sites-enab


led/office.your-domain.com-le-ss
l.conf

Add the green text to this file so it looks


like the following.

<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName office.your-domain.c
om

SSLCertificateFile /etc/letsenc
rypt/live/office.your-domain.com/
fullchain.pem
SSLCertificateKeyFile /etc/lets
encrypt/live/office.your-domain.c
om/privkey.pem
Include /etc/letsencrypt/option
s-ssl-apache.conf

# Encoded slashes need to be al


lowed
AllowEncodedSlashes NoDecode

# Container uses a unique non-s


igned certificate
SSLProxyEngine On
SSLProxyVerify None
SSLProxyCheckPeerCN Off
SSLProxyCheckPeerName Off
# keep the host
ProxyPreserveHost On

# static html, js, images, etc.


served from loolwsd
# loleaflet is the client part
of LibreOffice Online
ProxyPass /loleaflet https://12
7.0.0.1:9980/loleaflet retry=0
ProxyPassReverse /loleaflet htt
ps://127.0.0.1:9980/loleaflet

# WOPI discovery URL


ProxyPass /hosting/discovery ht
tps://127.0.0.1:9980/hosting/disc
overy retry=0
ProxyPassReverse /hosting/disco
very https://127.0.0.1:9980/hosti
ng/discovery

# Main websocket
ProxyPassMatch "/lool/(.*)/ws$"
wss://127.0.0.1:9980/lool/$1/ws n
ocanon

# Admin Console websocket


ProxyPass /lool/adminws wss://1
27.0.0.1:9980/lool/adminws

# Download as, Fullscreen prese


ntation and Image upload operatio
ns
ProxyPass /lool https://127.0.
0.1:9980/lool
ProxyPassReverse /lool https://
127.0.0.1:9980/lool

</VirtualHost>
</IfModule>

Save and close the file. Then restart


Apache web server.

sudo systemctl restart apache2

Now let’s see how to achieve the same


results with Nginx. 

Set up Nginx Reverse Proxy

Install Nginx on Ubuntu 16.04 with the


following command:

sudo apt install nginx

Create a virtual host file. Replace the


domain name with your actual domain
name for Collabora online server. Don’t
forget to create an A record for this domain
name.

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


e.your-domain.com.conf

Put the following text into the file.

server {
listen 80;
server_name office.your-domain.
com;

root /usr/share/nginx/office;

# static files
location ^~ /loleaflet {
proxy_pass https://localhost:
9980;
proxy_set_header Host $http_h
ost;
}

# WOPI discovery URL


location ^~ /hosting/discovery
{
proxy_pass https://localhost:
9980;
proxy_set_header Host $http_h
ost;
}

# websockets, download, present


ation and image upload
location ^~ /lool {
proxy_pass https://localhost:
9980;
proxy_set_header Upgrade $htt
p_upgrade;
proxy_set_header Connection "
upgrade";
proxy_set_header Host $http_h
ost;
}
}

Save and close the file. Create a directory


for this virtual host.

sudo mkdir /usr/share/nginx/offic


e

And let the Nginx user ( www-data ) be the


owner of this directory.

sudo chown www-data:www-data /usr


/share/nginx/office -R

Reload Nginx server.

sudo systemctl reload nginx

Obtain and Install TLS Certificate


in Nginx

Now let’s obtain a free TLS certificate from


Let’s encrypt. Install Let’s Encrypt client
(certbot) from the official certbot PPA with
the commands below.

sudo apt install software-propert


ies-common
sudo add-apt-repository ppa:certb
ot/certbot
sudo apt update
sudo apt install certbot python3-
certbot-nginx

Assuming you have created A record for


office.your-domain.com , run the following
command to automatically obtain and
install the certificate. Replace red text with
your actual data.

sudo certbot --nginx --agree-tos


--redirect --hsts --staple-ocsp
--email your-email-address -d off
ice.your-domain.com

You will see the following text indicating


that you have successfully obtained a TLS
certificate. Your certificate and chain have
been saved at /etc/letsencrypt
/live/office.your-domain.com/ directory.

Final Step: Connect


Nextcloud to Collabora
Online Server

In order to connect your Nextcloud server


to Collabora online server, first you need to
enable experimental apps in Nextcloud.

In your Nextcloud dashboard, go to Apps ,


Next, go to Office & Text section, find
Collabora Online app, click Download and
Enable button.

Finally, go to Nextcloud admin page. Click


Collabora Online tab on the left.  Enter
the domain name of your Collabora online
server including https:// prefix. Don’t
forget to click Apply button.

Now you should see a new Office app from


the drop-down menu.

And you are able to create Word,


spreadsheet and presentation documents
right from your Nextcloud server.

That’s it! I hope this tutorial helped you


install, run Collabora online server on
Ubuntu 16.04 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 Google+, Twitter or like our Facebook
page.

Rate this tutorial

[Total: 42 Average:
4.3]

Collabora Online Server LibreOffice Online


Nextcloud Online Office Suite


Ubuntu 16.04

You may also like:


How How Set Up How
to… to… Aut… to S…

How Easy! How 2 Easy


to… Co… to… Way…

Anda mungkin juga menyukai