As developers working on the Apereo Open Academic Environment, we are constantly looking for ways to make OAE better for our users in universities. One thing they often ask for is a more powerful word processor and a wider range of office tools. So we decided to take a look at LibreOffice Online, the new cloud version of the LibreOffice suite.
On paper, LibreOffice Online looks like the answer to all of our problems. It’s got the functionality, it's open source, it's under active development - plus it's backed by The Document Foundation, a well-established non-profit organisation.
However, it was pretty difficult to find any instructions on how to set up LibreOffice Online locally, or on how to integrate it with your own project. Much of the documentation that was available was focused on a commercial spin-off, Collabora Online, and there was little by way of instructions on how to build LibreOffice Online from source. We also couldn't find a community of people trying to do the same thing. (A notable exception to this is m-jowett who we found on GitHub).
Despite this, we decided to press on. It turned out to be even trickier than we expected, and so I decided to write up this post, partly to make it easier for others and partly in the hope that it might help get a bit more of a community going.
Most of the documentation recommends running LibreOffice Online (or LOO) using the official Docker container, found here. Since we recently introduced a dockerised development setup for OAE, this seems like a good fit. A downside to this is that you can’t tweak the compilation settings, and by default, LOO is limited to 20 connections and 10 documents.
While this limitation is fine for development, OAE deployments typically have tens or hundreds of thousands of users. We therefore decided to work on compiling LOO from source to see whether it would be possible to configure it in a way that allows it to support these kinds of numbers. As expected, this made the project substantially more challenging.
I’ve written down the steps to compile and install LOO in this way below. I’m writing this on Linux but they should work for OSX as well.
Installation steps
These installation steps rely heavily on this setup gist on GitHub by m-jowett, but have been updated for the latest version of LibreOffice Online. To install everything from source, you will need to have git and Node.js installed; if you don’t already have them, you can install both (plus npm, node package manager) with sudo apt-get install git nodejs npm
. You need to symlink Node.js to /usr/bin/node with sudo ln -s /usr/bin/nodejs /usr/bin/node
for the makefiles. You’ll also need to install several dependencies, so I recommend creating a new directory for this project to keep everything in one place. From your new directory, you can then clone the LOO repository from the read-only GitHub using git clone https://github.com/LibreOffice/online.git
.
Next, you’ll need to install some dependencies. Let’s start with C++ library POCO. POCO has dependencies of it’s own, which you can install using apt: sudo apt-get install openssl g++ libssl-dev
. Then you can download the source code for POCO itself with wget https://pocoproject.org/releases/poco-1.7.9/poco-1.7.9-all.tar.gz
. Uncompress the source files, and as root, run the following command from your newly uncompressed POCO directory:
./configure --prefix=/opt/poco
make install
This installs POCO at /opt/poco.
Then we need to install the LibreOffice Core. Go back to the top level project directory and clone the core repository: git clone https://github.com/LibreOffice/core.git
. Go into the new 'core' folder. Compiling the core from source requires some more dependencies from apt. Make sure the deb-src
line in /etc/apt/sources.list is not commented out. The exact line will depend on your locale and distro, but for me it’s deb-src http://fi.archive.ubuntu.com/ubuntu/ xenial main restricted
. Next, run the following commands:
sudo apt-get update
sudo apt-get build-dep libreoffice
sudo apt-get install libkrb5-dev
You can also now set the $MASTER environment variable, which will be used when configuring parts of LibreOffice Online:
export MASTER=$(pwd)
Then run autogen.sh to prepare for building the source with ./autogen.sh
. Finally, run make
to build the LibreOffice Core. This will take a long time, so you might want to leave it running while you do something else.
After the core is built successfully, go back to your project root folder and switch to the LibreOffice Online folder, /online. I recommend checking out the latest release, which for me was 2.1.2-13: git checkout 2.1.2-13
. We need to install yet more dependencies: sudo apt-get install -y libpng12-dev libcap-dev libtool m4 automake libcppunit-dev libcppunit-doc pkg-config
, after which you should install jake using npm: npm install -g jake
. We will also need a python library called polib. If you don’t have pip installed, first install it using sudo apt-get install python-pip
, then install the polib library using pip install polib
. We should also set some environment variables while here:
export SYSTEMPLATE=$(pwd)/systemplate
export ROOTFORJAILS=$(pwd)/jails
Run ./autogen.sh
to create the configuration file, then run the configuration script with:
./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 --with-max-connections=100000 –with-max-documents=100000
Next, build the websocket server, loolwsd, using make
. Create the caching directory in the default location with sudo mkdir -p /usr/local/var/cache/loolwsd
, then change caching permissions with sudo chmod -R 777 /usr/local/var/cache/loolwsd
. Test that you can run loolwsd with make run
. Try accessing the admin panel at https://localhost:9980/loleaflet/dist/admin/admin.html. You can stop it with CTRL+C
.
That, as they say, is it. You should now have a LibreOffice Online installation with a maximum connections and maximum documents both set to 100000. You can adjust these numbers to your liking by changing the with-max-connections and with-max-documents variables when configuring loolwsd.
Final words
Overall, I found this whole experience a bit discouraging. There was a lot of painful trial and error. We are still hoping to use LibreOffice Online for OAE in the future, but I wish it was easier to use. We'll be posting a request in The Document Foundation's LibreOffice forum for a docker version without the user limits to be released in future.
If you're also thinking about using LOO, or are already, and would like to swap notes, we'd love to hear from you. There are a few options. You can contact us via our mailing list at oae@apereo.org or directly at oaeproject@gmail.com