For the following process I assume you have an already working and running owncloud-server installation on your server. I have tested this on a VM with 16.04 LTS server, so no fancy own configurations, you may have to adapt that to fit your situation.
1. Preparation:
sudo apt-get install build-essential git libtool m4 autoconf automake libpng12-dev libcap-dev libpoco-dev
2. Creation of the distribution:
cd ~
git clone https://github.com/owncloud/richdocuments.git
cd richdocuments/
make dist
3. Installation of what we just created:
sudo apt-get install php-apcu
cd /var/www/owncloud/apps/
sudo tar -xf ~/richdocuments/owncloud-collabora-online-0.15.1.tar.gz
sudo mv owncloud-collabora-online-0.15.1/ richdocuments/
cd ../../config
sudo nano config.php
Add this line:
'memcache.local' => '\OC\Memcache\APCu'
After that:
cd ..
sudo ./occ app:enable richdocuments
Note: loolwsd is not included in the bundle you can get it with git clone https://github.com/LibreOffice/online.git, please refer to the README in the loolwsd subdirectory on how to build and setup. After that build loleaflet as well.
You need to configure the WOPI Client URL, which is where the LibreOffice Online WebSocket Daemon (loolwsd) is listening.
sudo ./occ config:app:set --value='https://<hostname or IP address>:<port>' richdocuments wopi_url
Default port is 9980. If loolwsd was compiled without SSL, you have to write http instead of https. If you use SSL, and you get the following error:
cURL error 60: SSL certificate problem: self signed certificate in certificate chain
You have to add the CA cert manually to ownCloud trusted cert storage:
sudo cat ca-chain.cert.pem >> owncloud/resources/config/ca-bundle.crt