Skip to content

Instantly share code, notes, and snippets.

@m-jowett
Last active January 3, 2023 07:53
Show Gist options
  • Save m-jowett/0f28bff952737f210574fc3b2efaa01a to your computer and use it in GitHub Desktop.
Save m-jowett/0f28bff952737f210574fc3b2efaa01a to your computer and use it in GitHub Desktop.
Setup LibreOffice Online (Log/Guide) [WIP]

Setup LibreOffice Online (Log/Guide) [WIP]

About

This guide/log is based off my experience attempting to build and install LibreOffice Online and it's dependencies on my system.

The end goal is to get LibreOffice Online integrated with Karoshi Server.

LibreOffice Online is still in development (17/06/16).

Each part is labeled with a number, if steps are labeled with the same number then they are an alternate method.

LibreOffice Online Wiki Page

Distro used in this guide: Xubuntu 16.04 amd64

I'll be updating this with progress as I go along, feel free to comment if you have any suggestions or feedback.

There are 2 parts of this guide as initially the plan was to build and install LibreOffice Online from source and then use it with LibreOnline-ownCloud to provide a way for server users to save and modify there work in Owncloud. However LibreOnline-ownCloud is now classed as "obsolete" with richdocuments taking it's place and therefore I went with this option as it seemed more stable and is being updated with the latest from LibreOffice Online.

Build and Install richdocuments in Owncloud.

In this guide I am using Karoshi Server V11 (160810-1116) with the Owncloud 9.0.1 module installed on the main domain controller.

This requires a built and working version of LibreOffice Online loolwsd and loleaflet. See below for a guide/log.

Install git which is required to clone the repositiory.

sudo apt-get install git

Clone the latest version of the richdocuments repository.

git clone https://github.com/owncloud/richdocuments.git

Enter the richdocuments directory.

cd richdocuments

Build a tarball using the makefile inside.

make dist

Extract the contents of the tarball in your server's Owncloud app folder. This is located at owncloud/apps.

For example on my system it is found under /var/www/html/owncloud/apps.

This may need to be run as root (or another superuser), depending on the folder permissions configured.

tar -xzf *.tar.gz -C /var/www/html/owncloud/apps
mv /var/www/html/owncloud/apps/owncloud-collabora-online-x.x.x /var/www/html/owncloud/apps/richdocuments

(With x.x.x representing the version of richdocuments you have cloned.)

Now there should be a folder named richdocuments within the apps folder.

Install the dependencies required for memcache.

sudo apt-get install php-apcu php-memcache

You may need to restart apache to enable the memcache module in php.

sudo service apache2 restart

Add 'memcache.local' => '\OC\Memcache\APCu', to owncloud/config/config.php.

For example on my system it is found under /var/www/html/owncloud/config/config.php.

This may need to be done as root (or another superuser), depending on the file permissions configured.

sed -i '$ d' /var/www/html/owncloud/config/config.php
echo "  'memcache.local' => '\OC\Memcache\APCu'," >> /var/www/html/owncloud/config/config.php
echo ");" >> /var/www/html/owncloud/config/config.php

The following steps require access to the occ (Owncloud Console). This is executed by your HTTP user.

For example on my system the console can be accessed by running:

sudo -u www-data php /var/www/html/owncloud/occ Followed by your arguments.

www-data is the HTTP user. php links to php, you may want to swap this out for /opt/rh/php54/root/usr/bin/php if php is not found. /var/www/html/owncloud/occ is the path to the owncloud folder using containing the php script occ.

sudo -u www-data php /var/www/html/owncloud/occ config:system:set --value='\OC\Memcache\APCu' memcache.local

If successful this will return: System config value memcache.local set to string \OC\Memcache\APCu

Then enable the richdocuments app.

sudo -u www-data php /var/www/html/owncloud/occ app:enable richdocuments

If successful this will return: richdocuments enabled.

There should now be a Collabra Online section under Admin in Owncloud, leave this for now.

You configure the WOPI Client URL (where the LibreOffice Online loolwsd is listening). For example I will configure it to https://192.168.210:9980 as this I'm using a test VM without a qualified domain name.

The default port is 9980.

sudo -u www-data php /var/www/html/owncloud/occ config:app:set --value='https://localhost:9980' richdocuments wopi_url

Move the ca-chain certificate into the OwnCloud ca-bundle if required (as root).: sudo cat /opt/karoshi/karoshi_user/online/loolwsd/etc/ca-chain.cert.pem >> /var/www/html/owncloud/resources/config/ca-bundle.crt

Build and Install LibreOffice Online from source

1. Introduction

Install git and wget.

sudo apt-get install git wget

Clone the LibreOffice Online repository from Github.

git clone https://github.com/LibreOffice/online.git

Enter the directory

cd online

Revert the repository back to the commit marking the most current tagged release on Github.

This is optional, however I was having issues compiling the latest master branch at commit c47c4fe5a487dd249c4e0a67b25a7a419c732a84 .

This guide is currently based off 1.7.2-1, with the latest commit of that tag being: aedd02a210498578444a6b2f4abb84eada012c7f .

git checkout aedd02a210498578444a6b2f4abb84eada012c7f

We can check that this was successful by checking the current commit HEAD is at.

git log -1

Move up a directory

cd ../

(The master branch at: commit 2757adc3c69ce345a9ba8a82166d75665b7e1ef1 compiles fine.)

2. Building LibreOffice On-Line WebSocket server (loolwsd)

Building/Installing the POCO Library

3. Install using Ubuntu package (broken for me)

Add the collaboraoffice PPA for POCO to /etc/apt/sources.list

deb https://www.collaboraoffice.com/apt-poco/ /

Update the sources list.

sudo apt-get update

It seems that the GPG key to verify the PPA wasn't installed in my keychain.

Get:5 https://www.collaboraoffice.com/apt-poco  InRelease [1,726 B]
Ign:5 https://www.collaboraoffice.com/apt-poco  InRelease
Fetched 1,726 B in 0s (2,668 B/s)
Reading package lists... Done
W: GPG error: https://www.collaboraoffice.com/apt-poco  InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0C54D189F4BA284D
W: The repository 'https://www.collaboraoffice.com/apt-poco  InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: There is no public key available for the following key IDs:
0C54D189F4BA284D

Install the GPG public key.

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

Attempt to update the sources again.

sudo apt-get update

Reading package lists... Done
W: https://www.collaboraoffice.com/apt-poco/InRelease: Signature by key 6CCEA47B2281732DF5D504D00C54D189F4BA284D uses weak digest algorithm (SHA1)

It seems that InRelease within the PPA defaults to use SHA1, which is now deprecated and rejected by Apt.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Therefore, I went on to build from source instead.

3. Building POCO from source

Install the dependencies required to compile the source.

sudo apt-get install openssl g++ libssl-dev

Download the source.

wget http://pocoproject.org/releases/poco-1.7.4/poco-1.7.4-all.tar.gz

Make a directory to store the decompressed files.

mkdir poco

Uncompress the source files into the directory.

tar -xv -C poco -f poco-1.7.4-all.tar.gz

Change directory into the source folder.

cd poco/poco-1.7.4-all

Switch to superuser before building the source and installing (script requires access to /opt/poco).

sudo su

Compile and install the POCO libraries to /opt/poco.

./configure --prefix=/opt/poco
make install

Switch back into an unpriviledged user (not root).

su <username>

The Poco libary should by found in /opt/poco, we will need to reference this folder later.

Move back up to the starting folder.

cd ../..

4. Downloading/Compiling LibreOffice Core

Clone the master branch of the GitHub repository.

git clone -b master --single-branch https://github.com/LibreOffice/core.git

Change directory into the source folder.

cd core

Reset the files back to the latest commit in case of accidental changes or formatting.

git reset --hard

Before compiling from source we need to install the LibreOffice required dependencies.

First, make sure that the deb-src for main is uncommented in the sources list (/etc/apt/sources.list).

For example on Xubuntu Xenial (16.04):

deb-src http://gb.archive.ubuntu.com/ubuntu/ xenial main restricted

Update the sources.

sudo apt-get update

Install the dependencies from the Ubuntu main PPA.

sudo apt-get build-dep libreoffice

The package libkrb5-dev seems to be not included, so we will install it separately.

sudo apt-get install libkrb5-dev

Now run autogen.sh in preparation of building the source.

./autogen.sh

Build LibreOffice core.

make

  • If the makefile returns the error below.
root@<hostname>:~/core# make

No. You make ME a sandwich.

Makefile:58: recipe for target 'check-if-root' failed
make: *** [check-if-root] Error 1
  • Move up to the directory containing the core folder.

cd ../

  • Recursively change the core folder and it's contents to be owned by your user.

sudo chown -R username:users core

  • Move back into core.

cd core

  • Build the source again, but with errors ignored.
root@<hostname>:~/core# make -i

No. You make ME a sandwich.

Makefile:58: recipe for target 'check-if-root' failed
make: [check-if-root] Error 1 (ignored)
  • The error should be ignored and the makefile will continue as normal.

5. Building and Installing LibreOffice On-Line WebSocket server (loolwsd)

Move back into the online/loolwsd directory.

cd ../online/loolwsd

Install/Update the dependencies needed to build.

sudo apt-get install -y libpng12-dev libcap-dev libtool m4 automake

Set the path name to the core folder as the variable $MASTER.

Make sure that it is not followed by a slash and is enclosed by quote marks, especially if your path name contains spaces.

For example on my test system: MASTER="/opt/karoshi/karoshi_user/core"

Then set the variables used for running loolwsd with loleaflet while we are in the loolwsd folder.

$(pwd) is the current directory path.

SYSTEMPLATE=$(pwd)/systemplate
ROOTFORJAILS=$(pwd)/jails

Install the required c++ libraries.

sudo apt-get install -y libcppunit-dev libcppunit-doc pkg-config

Run autogen.sh in preparation of building the source, this should generate configure.

./autogen.sh

Run the configure script in preparation for building loolwsd.

./configure --enable-silent-rules --with-lokit-path=${MASTER}/include --with-lo-path=${MASTER}/instdir --enable-debug --with-poco-includes=/opt/poco/include --with-poco-libs=/opt/poco/lib

Build loolwsd.

make or /usr/bin/make

Create the directory used for caching tiles as set in configure.ac.

If you did not pass a prefix changing this when running the configure script for loolwsd, the folder should be /usr/local/var/cache/loolwsd.

mkdir -p /usr/local/var/cache/loolwsd

Then change the owner of this folder to the current user (if it is not already).

sudo chown username /usr/local/var/cache/loolwsd

For some reason loolwsd looks in /etc/loolwsd for the self generated ssl certificates it requires. Therefore I created the folder and copied the certificates into it (as root).

sudo mkdir -p /etc/loolwsd
sudo cp /opt/karoshi/karoshi_user/online/loolwsd/etc/cert.pem /etc/loolwsd/cert.pem
sudo cp /opt/karoshi/karoshi_user/online/loolwsd/etc/key.pem /etc/loolwsd/cert/key.pem
sudo cp /opt/karoshi/karoshi_user/online/loolwsd/etc/ca-chain.cert.pem /etc/loolwsd/cert/ca-chain.cert.pem

Now loolwsd should run without SSL errors.

Then run loolwsd as an unprivilledged user (not root).

make run

You have to kill loolwsd by hitting CTRL+C before you install loleaflet.

5. Building Leaflet platform for LibreOffice On-Line (loleaflet)

I have not tested this extensively so you may find some errors which I have not included a fix here.

Please check the README file found in online/loleaflet as some common errors are addressed there. This is also linked in the Notes section.

Enter the loleaflet directory (from loolwsd).

cd ../loleaflet

Install npm (from node.js) if not installed already.

sudo apt-get install npm nodejs

Install dependencies needed to build loleaflet through npm.

npm install -g jake

Check whether npm is at least version 3.0.

npm -v

If not update npm.

npm install -g npm

Create a symbolic link for node.js as the makefile looks for node.js in /usr/bin/node.

sudo ln -s /usr/bin/nodejs /usr/bin/node

Build loleaflet, make sure you defined the variables SYSTEMPLATE, MASTER and ROOTFORJAILS from the loolwsd part of this log/guide.

make

To run loolwsd with loleaflet use:

./loolwsd --o:sys_template_path=${SYSTEMPLATE} --o:lo_template_path=${MASTER}/instdir --o:child_root_path=${ROOTFORJAILS}

You should now be able to access files within the browser under the URL (this does not include local files):

https://localhost:9980/loleaflet/dist/loleaflet.html?file_path=file:///PATH/TO_DOC&host=wss://localhost:9980

To access the admin panel go to:

https://localhost:9980/loleaflet/dist/admin/admin.html

When accessing the site you may be asked to trust a certificate if you are using a self-signed certificate on your server without a valid certificate authority.

-TODO/STILL TESTING-

Integrate LibreOnline-ownCloud with LibreOffice Online ("obsolete")

LibreOnline-ownCloud is now obsolete and is succeeded by richdocuments, check out the log/guide above and the repository linked under Notes.

This requires you to have built and installed LibreOffice Online from source (see the log/guide above) as well as having Owncloud setup and running on your server.

In this guide I am using Karoshi Server V11 (160810-1116) with the Owncloud 9.0.1 module installed on the main domain controller.

Notes

Sources/ Useful Links

LibreOffice/Core on Github

LibreOffice/Online on Github

LibreOnline-ownCloud on Github

richdocuments on Github

LibreOffice/Online loolwsd README on Github

LibreOffice/Online loleaflet README on Github

Building LibreOffice (Core) Guide

POCO C++ Libraries

Karoshi Server on Github

Karoshi Server V11 Download on Sourceforge

@marcosx86
Copy link

Hi everybody,

i can follow this up to the point where libreoffice/core gets to compile. Compiler blows up at this point:

[CUT] svl_qa_cppunit
[DEP] LNK:CppunitTest/libtest_toolkit.so
[LNK] CppunitTest/libtest_toolkit.so
(anonymous namespace)::Test::testNumberFormat finished in: 100ms
(anonymous namespace)::Test::testSharedString finished in: 0ms
(anonymous namespace)::Test::testSharedStringPool finished in: 0ms
(anonymous namespace)::Test::testSharedStringPoolPurge finished in: 0ms
(anonymous namespace)::Test::testFdo60915 finished in: 4ms
(anonymous namespace)::Test::testI116701 finished in: 3ms
(anonymous namespace)::Test::testTdf103060 finished in: 2ms
(anonymous namespace)::Test::testDateInput finished in: 13ms
(anonymous namespace)::Test::testIsNumberFormat finished in: 2ms
(anonymous namespace)::Test::testIsNumberFormatSpecific finished in: 9ms
unknown:0:(anonymous namespace)::Test::testUserDefinedNumberFormats
uncaught exception of type std::exception (or derived).

  • locale::facet::_S_create_c_locale name not valid

(anonymous namespace)::Test::testUserDefinedNumberFormats finished in: 13ms
(anonymous namespace)::Test::testNfEnglishKeywordsIntegrity finished in: 2ms
(anonymous namespace)::Test::testStandardColorIntegrity finished in: 1ms
(anonymous namespace)::Test::testColorNamesConversion finished in: 3ms
##Failure Location unknown## : Error
Test name: (anonymous namespace)::Test::testUserDefinedNumberFormats
uncaught exception of type std::exception (or derived).

  • locale::facet::_S_create_c_locale name not valid

Failures !!!
Run: 14 Failure total: 1 Failures: 0 Errors: 1

Error: a unit test failed, please do one of:

make CppunitTest_svl_qa_cppunit CPPUNITTRACE="gdb --args"

for interactive debugging on Linux

make CppunitTest_svl_qa_cppunit VALGRIND=memcheck

for memory checking

make CppunitTest_svl_qa_cppunit DEBUGCPPUNIT=TRUE

for exception catching

You can limit the execution to just one particular test by:

make CPPUNIT_TEST_NAME="testXYZ" ...above mentioned params...

/buildfiles/core/solenv/gbuild/CppunitTest.mk:116: recipe for target '/buildfiles/core/workdir/CppunitTest/svl_qa_cppunit.test' failed
make[1]: *** [/buildfiles/core/workdir/CppunitTest/svl_qa_cppunit.test] Error 1
make[1]: *** Waiting for unfinished jobs....
Makefile:286: recipe for target 'build' failed
make: *** [build] Error 2

I already tried to replace the cppunit of my system with the most recent 14.0 version, but the problem remains.
Any Ideas? Is this a bug i should report, or is this something that my machine messes up?

Hey there,

I got that too. Happens when you use --with-locales on core. The ./configure says that it might break (for sure).

Don't use it.

Regards...

@tuxcrafter
Copy link

Hello everybody is there an updated script to install loolwsd libreoffice-online as replacement of collabora?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment