Build libreoffice online 6.0.0.3 on debian 9.11

Hello
In order to increase the number of documents (collabora online allows only 10 docs) I tried first to compile libreoffice online 6.0.0.3 under debian 10. Didn’t work.
But now I managed to compile it under debian 9.11 (Virtualbox Version 6.0.8 r130520). I added an additinal language (de) and some dictionaries (en, de, fr ,it). further I increased the number of documents, that are allowed, to 50.

Before I succeded ther wre a lot of try and error, but I finally I got some bash scripts that allowed me to build libreoffice online 6.0.0.3. To be honest “my way of compiling” bases on the thoughts of another person, but unfortuantelly can’t remember his name.

My way of compilling

Step 1: set up a debian 9.11 system with a minimal XFCE4 desk

look at the internet for howtos.

Step 2: set up compiling enviroment

#!/bin/bash

set -e

export BASE_DIR="$(pwd)"
export BUILD_DIR="${BASE_DIR}/build"
export LOG_DIR="${BASE_DIR}/logs"
export PKG_DIR="${BASE_DIR}/packages"
export SRC_DIR="${BASE_DIR}/sources"

export POCO_VERSION="1.9.4"
export LOC_VERSION="libreoffice-6.0.0.3"
export LOOL_VERSION="libreoffice-online-6.0.0.3"
export LOOL_PREFIX="/opt/lool"
export POCO_PREFIX="${LOOL_PREFIX}"

mkdir -p ${BUILD_DIR}
mkdir -p ${LOG_DIR}
mkdir -p ${PKG_DIR}
mkdir -p ${SRC_DIR}/poco
mkdir -p ${SRC_DIR}/core
mkdir -p ${SRC_DIR}/online

chown -R $(whoami).$(whoami) ${BUILD_DIR}
chmod -R 2777 ${BUILD_DIR}

cd ${SRC_DIR}/poco
wget https://pocoproject.org/releases/poco-${POCO_VERSION}/poco-${POCO_VERSION}-all.tar.gz

cd ${SRC_DIR}/core
wget http://download.documentfoundation.org/libreoffice/src/$(echo ${LOC_VERSION} | awk -F'-' '{print substr($NF,1,5)}')/${LOC_VERSION}.tar.xz
#wget http://download.documentfoundation.org/libreoffice/src/$(echo ${LOC_VERSION} | awk -F'-' '{print substr($NF,1,5)}')/$(echo ${LOC_VERSION} | awk -F'-' '{print $1}')-translations-$(echo ${LOC_VERSION} | awk -F'-' '{print $NF}').tar.xz
#wget http://download.documentfoundation.org/libreoffice/src/$(echo ${LOC_VERSION} | awk -F'-' '{print substr($NF,1,5)}')/$(echo ${LOC_VERSION} | awk -F'-' '{print $1}')-dictionaries-$(echo ${LOC_VERSION} | awk -F'-' '{print $NF}').tar.xz
#wget http://download.documentfoundation.org/libreoffice/src/$(echo ${LOC_VERSION} | awk -F'-' '{print substr($NF,1,5)}')/$(echo ${LOC_VERSION} | awk -F'-' '{print $1}')-help-$(echo ${LOC_VERSION} | awk -F'-' '{print $NF}').tar.xz

cd ${SRC_DIR}/online
wget http://download.documentfoundation.org/libreoffice/src/$(echo ${LOOL_VERSION} | awk -F'-' '{print substr($NF,1,5)}')/${LOOL_VERSION}.tar.xz

sudo apt update
sudo apt upgrade -y
sudo apt install devscripts equivs -y
sudo mk-build-deps -i -r libreoffice
sudo apt install libhunspell-dev hunspell-fr hunspell-de-de hunspell-it hunspell-en-us -y
sudo apt install libmythes-dev mythes-en-us mythes-de mythes-it mythes-fr -y
sudo apt install libtool libegl1-mesa-dev libkrb5-dev graphviz libiodbc2 libiodbc2-dev openssl libssl-dev -y
sudo apt install libcunit1 libcunit1-dev libcap-dev python-polib python3-polib -y
sudo apt install curl software-properties-common -y
curl -sL https://deb.nodesource.com/setup_12.x | sudo bash -
sudo apt install nodejs -y
sudo npm install -g jake

Hint: check the type of the tar files (tar.gz versus tar.xz) and adapt the script.

Step 3: build poco 1.9.4

#!/bin/bash

set -e

export BASE_DIR="$(pwd)"
export BUILD_DIR="${BASE_DIR}/build"
export LOG_DIR="${BASE_DIR}/logs"
export PKG_DIR="${BASE_DIR}/packages"
export SRC_DIR="${BASE_DIR}/sources"

export POCO_VERSION="1.9.4"
export LOC_VERSION="libreoffice-6.0.0.3"
export LOOL_VERSION="libreoffice-online-6.0.0.3"
export LOOL_PREFIX="/opt/lool"
export POCO_PREFIX="${LOOL_PREFIX}"

cd ${BUILD_DIR}
tar xvf ${SRC_DIR}/poco/poco-${POCO_VERSION}-all.tar.gz
cd poco-${POCO_VERSION}-all
./configure --prefix=${POCO_PREFIX} | tee ${LOG_DIR}/poco-${POCO_VERSION}-all.log 2>&1
make -j 4 | tee -a ${LOG_DIR}/poco-${POCO_VERSION}-all.log 2>&1
sudo make install | tee -a ${LOG_DIR}/poco-${POCO_VERSION}-all.log 2>&1
sudo make install DESTDIR="${BUILD_DIR}/install" | tee -a ${LOG_DIR}/poco-${POCO_VERSION}-all.log 2>&1
sudo tar -C ${BUILD_DIR}/install${POCO_PREFIX}/ -cvJf ${PKG_DIR}/poco-${POCO_VERSION}.tar.xz .

cd ${BUILD_DIR}
sudo /bin/rm -rf ${BUILD_DIR}/install

Step 4: build libreoffice core 6.0.0.3

#!/bin/bash

set -e

export BASE_DIR="$(pwd)"
export BUILD_DIR="${BASE_DIR}/build"
export LOG_DIR="${BASE_DIR}/logs"
export PKG_DIR="${BASE_DIR}/packages"
export SRC_DIR="${BASE_DIR}/sources"

export POCO_VERSION="1.9.4"
export LOC_VERSION="libreoffice-6.0.0.3"
export LOOL_VERSION="libreoffice-online-6.0.0.3"
export LOOL_PREFIX="/opt/lool"
export POCO_PREFIX="${LOOL_PREFIX}"


cd ${BUILD_DIR}

tar xvJf ${SRC_DIR}/core/${LOC_VERSION}.tar.xz
cd ${LOC_VERSION}
echo "lo_sources_ver=$(echo ${LOC_VERSION} | awk -F'-' '{print $NF}')" >sources.ver
./autogen.sh --prefix=${LOOL_PREFIX} \
 --enable-release-build \
 --with-system-mythes \
 --with-system-hunspell \
 --with-lang="en-US de" \
 --without-help \
 --without-myspell-dicts \
 --without-doxygen \
 --with-parallelism | \
 tee ${LOG_DIR}/${LOC_VERSION}.log 2>&1
make fetch
make | tee -a ${LOG_DIR}/${LOC_VERSION}.log 2>&1
make check | tee -a ${LOG_DIR}/${LOC_VERSION}.log 2>&1
sudo make install | tee -a ${LOG_DIR}/${LOC_VERSION}.log 2>&1
sudo make install DESTDIR="${BUILD_DIR}/install" | tee -a ${LOG_DIR}/${LOC_VERSION}.log 2>&1
sudo tar -C ${BUILD_DIR}/install${LOOL_PREFIX}/ -cvJf ${PKG_DIR}/${LOC_VERSION}.tar.xz .

cd ${BUILD_DIR}
sudo /bin/rm -rf ${BUILD_DIR}/install

Step 5: build libreoffice online 6.0.0.3 (loolwsd)

#!/bin/bash

set -e

export BASE_DIR="$(pwd)"
export BUILD_DIR="${BASE_DIR}/build"
export LOG_DIR="${BASE_DIR}/logs"
export PKG_DIR="${BASE_DIR}/packages"
export SRC_DIR="${BASE_DIR}/sources"

export POCO_VERSION="1.9.4"
export LOC_VERSION="libreoffice-6.0.0.3"
export LOOL_VERSION="libreoffice-online-6.0.0.3"
export LOOL_PREFIX="/opt/lool"
export POCO_PREFIX="${LOOL_PREFIX}"

cd ${BUILD_DIR}
tar xvJf ${SRC_DIR}/online/${LOOL_VERSION}.tar.xz

cd ${LOOL_VERSION}
sed --in-place "s#POCOLIBDIRS=\"/usr/local/lib /opt/poco/lib\"#POCOLIBDIRS=\"${POCO_PREFIX}/lib\"#" loolwsd-systemplate-setup

export LOC_DISTRO="$(basename $(find ${LOOL_PREFIX}/lib -maxdepth 1 -type d -name "*office"))"

./autogen.sh | tee ${LOG_DIR}/${LOOL_VERSION}.log 2>&1
./configure --prefix=${LOOL_PREFIX} \
 --with-poco-includes=${POCO_PREFIX}/include \
 --with-poco-libs=${POCO_PREFIX}/lib \
 --with-lokit-path=../${LOC_VERSION}/include \
 --with-lo-path=${LOOL_PREFIX}/lib/${LOC_DISTRO} \
 --with-logfile=${LOOL_PREFIX}/var/log/loolwsd/loolwsd.log \
 --with-max-documents="50" \
 --with-max-connections="100" | \
 tee -a ${LOG_DIR}/${LOOL_VERSION}.log 2>&1
make -j 4 | tee -a ${LOG_DIR}/${LOOL_VERSION}.log 2>&1
sudo make install | tee -a ${LOG_DIR}/${LOOL_VERSION}.log 2>&1
sudo make install DESTDIR="${BUILD_DIR}/install" | tee -a ${LOG_DIR}/${LOOL_VERSION}.log 2>&1
sudo tar -C ${BUILD_DIR}/install${LOOL_PREFIX}/ -cvJf ${PKG_DIR}/$(echo ${LOOL_VERSION} | awk -F'-' '{print $1}')-loolwsd-$(echo ${LOOL_VERSION} | awk -F'-' '{print $NF}').tar.xz .

cd ${BUILD_DIR}
sudo /bin/rm -rf ${BUILD_DIR}/install

Step 6: build libreoffice online 6.0.0.3 (loleafleat)
I did this step, because I wanted to mimic “the way of compiling” that worked for libroffice online 5.x.x.x and was developed from the person, that name I can’t remember. But i could be that this is unnecessary.

#!/bin/bash

set -e

export BASE_DIR="$(pwd)"
export BUILD_DIR="${BASE_DIR}/build"
export LOG_DIR="${BASE_DIR}/logs"
export PKG_DIR="${BASE_DIR}/packages"
export SRC_DIR="${BASE_DIR}/sources"

export POCO_VERSION="1.9.4"
export LOC_VERSION="libreoffice-6.0.0.3"
export LOOL_VERSION="libreoffice-online-6.0.0.3"
export LOOL_PREFIX="/opt/lool"
export POCO_PREFIX="${LOOL_PREFIX}"

cd ${BUILD_DIR}
cd ${LOOL_VERSION}/loleaflet
sudo tar -zcvf loleaflet-$(echo ${LOOL_VERSION} | awk -F'-' '{print $NF}').tar.gz dist
sudo /bin/mv loleaflet-*.tar.gz ${PKG_DIR}/$(echo ${LOOL_VERSION} | awk -F'-' '{print $1}')-loleaflet-$(echo ${LOOL_VERSION} | awk -F'-' '{print $NF}').tar.gz

cd ${BUILD_DIR}

sudo mkdir -p ${LOOL_PREFIX}/var/www/loleaflet
sudo tar -C ${LOOL_PREFIX}/var/www/loleaflet -xvf ${PKG_DIR}/$(echo ${LOOL_VERSION} | awk -F'-' '{print $1}')-loleaflet-$(echo ${LOOL_VERSION} | awk -F'-' '{print $NF}').tar.gz
sudo touch ${LOOL_PREFIX}/var/www/loleaflet/dist/branding.css
sudo touch ${LOOL_PREFIX}/var/www/loleaflet/dist/branding.js
sudo /bin/cp -a ${LOOL_PREFIX}/var/www/loleaflet/dist/l10n ${LOOL_PREFIX}/var/www/loleaflet/dist/admin/
sudo chown -R root:root ${LOOL_PREFIX}/var/www/loleaflet
sudo chmod -R g-w,o-w ${LOOL_PREFIX}/var/www/loleaflet
export LOOL_DISTRO="$(ls -1 ${LOOL_PREFIX}/etc)"
sudo /bin/cp -a ${LOOL_PREFIX}/share/${LOOL_DISTRO}/* ${LOOL_PREFIX}/var/www/

Step 7: build the LOOL install package (will be transferd to the nextcloud server)

#!/bin/bash

set -e

export BASE_DIR="$(pwd)"
export BUILD_DIR="${BASE_DIR}/build"
export LOG_DIR="${BASE_DIR}/logs"
export PKG_DIR="${BASE_DIR}/packages"
export SRC_DIR="${BASE_DIR}/sources"

export POCO_VERSION="1.9.4"
export LOC_VERSION="libreoffice-6.0.0.3"
export LOOL_VERSION="libreoffice-online-6.0.0.3"
export LOOL_PREFIX="/opt/lool"
export POCO_PREFIX="${LOOL_PREFIX}"

cd ${BUILD_DIR}

export PACKAGE_NAME=lool-poco-${POCO_VERSION}-${LOC_VERSION}-${LOOL_VERSION}
sudo tar -C ${LOOL_PREFIX} -cvJf ${PKG_DIR}/${PACKAGE_NAME}.tar.xz .

#rm -rf ${LOOL_PREFIX}

Step 7: transfer install package to the nextcloud server
You will find a way ,-)

Step 8: install LOOL package on the nextcloud server (untested)
I have build all packages on a Debian Stretch System using Virtualbox 6.0.12. in Step 6 I build a tar.xz file from the install directory /opt/lool. in Step 7 I copied the tar.xz file to an USB Stick so that I can copy the tar.xz file to the server where Libreoffice Online should run.
With the BASH script below I install Libreoffice Online on the server unter the directory /opt/lool. Further the script installs an configure Ioolwsd.xml under /opt/lool/etc and installs loolwsd.service under /etc/systemd/system so that one can enable, disable, start, stop the loolwsd daemon.

#!/bin/bash

#set -e

export BASE_DIR="$(pwd)"
export BUILD_DIR="${BASE_DIR}/build"
export LOG_DIR="${BASE_DIR}/logs"
export PKG_DIR="${BASE_DIR}/packages"
export SRC_DIR="${BASE_DIR}/sources"

export POCO_VERSION="1.9.4"
export LOC_VERSION="libreoffice-6.0.0.3"
export LOOL_VERSION="libreoffice-online-6.0.0.3"
export LOOL_PREFIX="/opt/lool"
export POCO_PREFIX="${LOOL_PREFIX}"
export PACKAGE_NAME="lool-poco-${POCO_VERSION}-${LOC_VERSION}-${LOOL_VERSION}"

# next variables has to be personalized
export LOOL_ADMIN_NAME="admin" # replace admin with what you want
export LOOL_ADMIN_PASSWD="password" # replace password with what you want
export LO_DOC_SIZE="0"
export CLOUD_PUBLIC_DOMAIN="example.com" # replace with your domain
export LOOL_PUBLIC_DOMAIN="lool.example.com" # replace with you lool subdomain
export LOOL_PUBLIC_SA="admin@example.com"

sudo apt install dnsutils liblangtag1 libiodbc2 libcunit1 python-polib python3-polib hyphen-en-us hyphen-de --yes

sudo rm -rf ${LOOL_PREFIX}
sudo mkdir -p ${LOOL_PREFIX}
INSTALL_ARCHIVE=$(find /home -type f -name ${PACKAGE_NAME}* 2>/dev/null)
if [ -n ${INSTALL_ARCHIVE} ]
then
	sudo tar -C ${LOOL_PREFIX} -xf ${INSTALL_ARCHIVE}
else
	exit 1
fi

LOOL_USER=$(echo ${LOOL_PREFIX} | awk -F"/" '{print $NF}')
LOOL_GROUP="${LOOL_USER}"
LOOL_GID=$(cat /etc/group | awk -F: '($3>0) && ($3<800) && ($3>maxuid) { maxuid=$3; } END { print maxuid+1; }')
LOOL_UID=$(cat /etc/passwd | awk -F: '($3>0) && ($3<800) && ($3>maxuid) { maxuid=$3; } END { print maxuid+1; }')

if [ ${LOOL_UID} -eq ${LOOL_GID} ]
then
  echo ${LOOL_UID}
elif [ ${LOOL_UID} -gt ${LOOL_GID} ]
then
  echo ${LOOL_UID}
else
  LOOL_UID=${LOOL_GID}
  echo ${LOOL_UID}
fi

if id ${LOOL_USER} >/dev/null 2>&1
then
  sudo deluser --quiet ${LOOL_USER}
fi
if getent group ${LOOL_GROUP} >/dev/null 2>&1
then
  sudo delgroup --quiet ${LOOL_GROUP}
fi
sudo /usr/sbin/useradd --system --comment "system user libreoffice online" --uid ${LOOL_UID} -U --home-dir ${LOOL_PREFIX} --shell /usr/sbin/nologin ${LOOL_USER} 

sudo /sbin/setcap cap_fowner,cap_mknod,cap_sys_chroot=ep ${LOOL_PREFIX}/bin/loolforkit

sudo mkdir -p ${LOOL_PREFIX}/var/tmp
sudo mkdir -p ${LOOL_PREFIX}/var/log/loolwsd
sudo mkdir -p ${LOOL_PREFIX}/var/jails
sudo mkdir -p ${LOOL_PREFIX}/var/cache/${LOOL_DISTRO}

sudo chown ${LOOL_USER}:${LOOL_GROUP} ${LOOL_PREFIX}/var/tmp
sudo chown ${LOOL_USER}:${LOOL_GROUP} ${LOOL_PREFIX}/var/log/loolwsd
sudo chown ${LOOL_USER}:${LOOL_GROUP} ${LOOL_PREFIX}/var/jails
sudo chown ${LOOL_USER}:${LOOL_GROUP} ${LOOL_PREFIX}/var/cache/${LOOL_DISTRO}

sudo chown root:${LOOL_GROUP} ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/*
sudo chmod o-r ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/*

export LOOL_DISTRO=$(ls -1 ${LOOL_PREFIX}/etc)
export OFFICE_PATH=$(find ${LOOL_PREFIX}/lib -maxdepth 1 -type d -name "*office*")
export SRVROOT_DIR=$(find ${LOOL_PREFIX} -type d -name loleaflet | grep var)
export SRVROOT_DIR=${SRVROOT_DIR%/*}
export CACHE_DIR=$(find ${LOOL_PREFIX} -type d -name cache | grep var | grep -v systemplate)
export CHILDROOT_DIR=$(find ${LOOL_PREFIX} -type d -name jails | grep var)
export LOCORE_DIR=$(dirname $(find ${LOOL_PREFIX} -type f -name soffice.bin | grep libreoffice))
export LOCORE_DIR=${LOCORE_DIR%/*}
export JAILS_DIR=$(find ${LOOL_PREFIX} -type d -name jails | grep var)
export LOG_DIR=$(find ${LOOL_PREFIX} -type d -name loolwsd | grep var)
export LOG_FILE=${LOG_DIR}/loolwsd.log
export SSL_DIR=${LOOL_PREFIX}/etc/${LOOL_DISTRO}
export SSL_KEY="key.pem"
export SSL_CSR="cert.csr"
export SSL_CERT="cert.pem"
export SSL_CHAIN="ca-chain.cert.pem"
export RANDOM_NUM=$(tr -dc 0-9 </dev/urandom |  head -c 8)
export CLOUD_PUBLIC_DOMAIN=$(echo ${CLOUD_PUBLIC_DOMAIN} | sed 's/\./\\./g')
export LOOL_PUBLIC_DOMAIN=$(echo ${LOOL_PUBLIC_DOMAIN} | sed 's/\./\\./g')


REPLACE=$(echo $(dirname $(cd /; find lib -type f -name ld-*)) | awk -F' ' '{print $1}')
sudo sed --in-place "s#lib/ld\-\* lib64/ld\-\*#${REPLACE}/ld-*#g" ${LOOL_PREFIX}/bin/loolwsd-systemplate-setup
REPLACE=$(echo $(dirname $(cd /; find lib -type f -name libcap*)) | awk -F' ' '{print $1}')
sudo sed --in-place "s#lib/libcap\* lib64/libcap\* lib/\*\-linux-gnu/libcap\*#${REPLACE}/libcap*#g" ${LOOL_PREFIX}/bin/loolwsd-systemplate-setup
REPLACE=$(echo $(dirname $(cd /; find lib -type f -name libattr*)) | awk -F' ' '{print $1}')
sudo sed --in-place "s#lib/libattr\* lib/\*-linux-gnu/libattr\*#${REPLACE}/libattr*#g" ${LOOL_PREFIX}/bin/loolwsd-systemplate-setup
REPLACE=$(echo $(dirname $(cd /; find lib -type f -name libnss_*)) | awk -F' ' '{print $1}')
sudo sed --in-place "s#lib/libnss\_\* lib64/libnss\_\* lib/\*\-linux-gnu/libnss\*#${REPLACE}/libnss_*#g" ${LOOL_PREFIX}/bin/loolwsd-systemplate-setup
REPLACE=$(echo $(dirname $(cd /; find usr/lib -type f -name libpng*)) | awk -F' ' '{print $1}')
sudo sed --in-place "s#usr/lib/libpng\* usr/lib64/libpng\* lib/\*\-linux-gnu/libpng*#${REPLACE}/libpng*#g" ${LOOL_PREFIX}/bin/loolwsd-systemplate-setup
REPLACE1=$(echo $(dirname $(cd /; find usr/lib/locale -type f -name locale*archive)) | awk -F' ' '{print $1}')
REPLACE2=$(echo $(basename $(cd /; find usr/lib/locale -type f -name locale*archive)) | awk -F' ' '{print $1}')
sudo sed --in-place "s#usr/lib/locale/locale\_archive#${REPLACE1}/${REPLACE2}#g" ${LOOL_PREFIX}/bin/loolwsd-systemplate-setup
REPLACE=$(echo $(dirname $(cd /; find usr/lib -type f -name liblcms2*)) | awk -F' ' '{print $1}')
sudo sed --in-place "s#usr/lib/\*\-linux-gnu/liblcms2\*#${REPLACE}/liblcms2*#g" ${LOOL_PREFIX}/bin/loolwsd-systemplate-setup
sudo sed --in-place '#usr/lib/locale/en\_US\.utf8#d' ${LOOL_PREFIX}/bin/loolwsd-systemplate-setup

sudo ${LOOL_PREFIX}/bin/loolwsd-systemplate-setup ${LOOL_PREFIX}/var/systemplate ${OFFICE_PATH}
export SYSPLATE_DIR=$(find ${LOOL_PREFIX} -type d -name systemplate | grep var)


cat << EOF1 > ${HOME}/loolwsd.service
[Unit]
Description=LibreOffice Online WebSocket Daemon
After=network.target

[Service]
Type=simple
User=lool
ExecStart=${LOOL_PREFIX}/bin/loolwsd --version --o:sys_template_path=${SYSPLATE_DIR} --o:lo_template_path=${LOCORE_DIR} --o:child_root_path=${CHILDROOT_DIR} --o:file_server_root_path=${SRVROOT_DIR}
KillMode=control-group 
Restart=always

[Install]
WantedBy=multi-user.target
EOF1

sudo mv ${HOME}/loolwsd.service /etc/systemd/system/loolwsd.service
sudo systemctl daemon-reload
sudo systemctl enable loolwsd


cat << EOF2 > ${HOME}/loolwsd.xml
<config>
  <!-- Note: default attributes are used to document a default value as well as to use as fallback. -->
  <!-- Note: When adding a new entry, a default must be set in WSD in case the entry is missing upon deployment. -->
  
  <tile_cache_path desc="Path to a directory where to keep the tile cache." type="path" relative="false" default="${CACHE_DIR}">${CACHE_DIR}</tile_cache_path>
  <sys_template_path desc="Path to a template tree with shared libraries etc to be used as source for chroot jails for child processes." type="path" relative="false" default="${SYSPLATE_DIR}">${SYSPLATE_DIR}</sys_template_path>
  <lo_template_path desc="Path to a LibreOffice installation tree to be copied (linked) into the jails for child processes. Should be on the same file system as systemplate." type="path" relative="false" default="${LOCORE_DIR}">${LOCORE_DIR}</lo_template_path>
  <child_root_path desc="Path to the directory under which the chroot jails for the child processes will be created. Should be on the same file system as systemplate and lotemplate. Must be an empty directory." type="path" relative="false" default="${JAILS_DIR}">${JAILS_DIR}</child_root_path>

  <server_name desc="Hostname:port of the server running loolwsd. If empty, it's derived from the request." type="string" default=""></server_name>
  <file_server_root_path desc="Path to the directory that should be considered root for the file server. This should be the directory containing loleaflet." type="path" relative="false" default="${SRVROOT_DIR}">${SRVROOT_DIR}</file_server_root_path>

  <memproportion desc="The maximum percentage of system memory consumed by all of the LibreOffice Online, after which we start cleaning up idle documents" type="double" default="80.0">60.0</memproportion>
  <num_prespawn_children desc="Number of child processes to keep started in advance and waiting for new clients." type="uint" default="1">1</num_prespawn_children>
  
  <per_document desc="Document-specific settings, including LO Core settings.">
    <max_concurrency desc="The maximum number of threads to use while processing a document." type="uint" default="4">4</max_concurrency>
    <idle_timeout_secs desc="The maximum number of seconds before unloading an idle document. Defaults to 1 hour." type="uint" default="3600">3600</idle_timeout_secs>
    <idlesave_duration_secs desc="The number of idle seconds after which document, if modified, should be saved. Defaults to 30 seconds." type="uint" default="30">300</idlesave_duration_secs>
    <autosave_duration_secs desc="The number of seconds after which document, if modified, should be saved. Defaults to 5 minutes." type="uint" default="300">600</autosave_duration_secs>
    <limit_virt_mem_kb desc="The maximum virtual memory allowed to each document process. 0 for unlimited, 1700 min." type="uint">0</limit_virt_mem_kb>
    <limit_data_mem_kb desc="The maximum memory data segment allowed to each document process. 0 for unlimited." type="uint">0</limit_data_mem_kb>
    <limit_stack_mem_kb desc="The maximum stack size allowed to each document process. 0 for unlimited." type="uint">8000</limit_stack_mem_kb>
    <limit_file_size_mb desc="The maximum file size allowed to each document process to write. 0 for unlimited." type="uint">0</limit_file_size_mb>
    <limit_num_open_files desc="The maximum number of files allowed to each document process to open. 0 for unlimited." type="uint">0</limit_num_open_files>
    <limit_load_secs desc="Maximum number of seconds to wait for a document load to succeed. 0 for unlimited." type="uint" default="100">60</limit_load_secs>
  </per_document>
  
  <per_view desc="View-specific settings.">
    <out_of_focus_timeout_secs desc="The maximum number of seconds before dimming and stopping updates when the browser tab is no longer in focus. Defaults to 60 seconds." type="uint" default="60">120</out_of_focus_timeout_secs>
    <idle_timeout_secs desc="The maximum number of seconds before dimming and stopping updates when the user is no longer active (even if the browser is in focus). Defaults to 15 minutes." type="uint" default="900">600</idle_timeout_secs>
  </per_view>

  <loleaflet_html desc="Allows UI customization by replacing the single endpoint of loleaflet.html" type="string" default="loleaflet.html">loleaflet.html</loleaflet_html>
  
  <logging>
    <color type="bool">true</color>
    <level type="string" desc="Can be 0-8, or none (turns off logging), fatal, critical, error, warning, notice, information, debug, trace" default="warning">warning</level>
    <file enable="false">
      <property name="path" desc="Log file path.">${LOG_FILE}</property>
      <property name="rotation" desc="Log file rotation strategy. See Poco FileChannel.">never</property>
      <property name="archive" desc="Append either timestamp or number to the archived log filename.">timestamp</property>
      <property name="compress" desc="Enable/disable log file compression.">false</property>
      <property name="purgeAge" desc="The maximum age of log files to preserve. See Poco FileChannel.">14 days</property>
      <property name="purgeCount" desc="The maximum number of log archives to preserve. Use 'none' to disable purging. See Poco FileChannel.">10</property>
      <property name="rotateOnOpen" desc="Enable/disable log file rotation on opening.">true</property>
      <property name="flush" desc="Enable/disable flushing after logging each line. May harm performance. Note that without flushing after each line, the log lines from the different processes will not appear in chronological order.">false</property>
    </file>
    <anonymize>
      <anonymize_user_data type="bool" desc="Enable to anonymize/obfuscate of user-data in logs. If default is true, it was forced at compile-time and cannot be disabled." default="false">true</anonymize_user_data>
      <anonymization_salt type="uint" desc="The salt used to anonymize/obfuscate user-data in logs. Use a secret 64-bit random number." default="82589933">${RANDOM_NUM}</anonymization_salt>
    </anonymize>
  </logging>

  <loleaflet_logging desc="Logging in the browser console" default="false">false</loleaflet_logging>
 
  <trace desc="Dump commands and notifications for replay. When 'snapshot' is true, the source file is copied to the path first." enable="true">
    <path desc="Output path to hold trace file and docs. Use '%' for timestamp to avoid overwriting." compress="true" snapshot="false">/tmp/looltrace-%.gz</path>
    <filter>
      <message desc="Regex pattern of messages to exclude"></message>
    </filter>
    <outgoing>
      <record desc="Whether or not to record outgoing messages" default="false">false</record>
    </outgoing>
  </trace>

  <ssl desc="SSL settings">
    <enable type="bool" default="true">true</enable>
    <termination desc="Connection via proxy where loolwsd acts as working via https, but actually uses http." type="bool" default="true">false</termination>
    <cert_file_path desc="Path to the cert file" relative="false">${SSL_DIR}/${SSL_CERT}</cert_file_path>
    <key_file_path desc="Path to the key file" relative="false">${SSL_DIR}/${SSL_KEY}</key_file_path>
    <ca_file_path desc="Path to the ca file" relative="false">${SSL_DIR}/${SSL_CHAIN}</ca_file_path>
    <cipher_list desc="List of OpenSSL ciphers to accept" default="ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"></cipher_list>
    <hpkp desc="Enable HTTP Public key pinning" enable="false" report_only="false">
      <max_age desc="HPKP's max-age directive - time in seconds browser should remember the pins" enable="true">1000</max_age>
      <report_uri desc="HPKP's report-uri directive - pin validation failure are reported at this URL" enable="false"></report_uri>
      <pins desc="Base64 encoded SPKI fingerprints of keys to be pinned">
        <pin></pin>
      </pins>
    </hpkp>
  </ssl>

  <storage desc="Backend storage">
    <filesystem allow="false" />
    <wopi desc="Allow/deny wopi storage. Mutually exclusive with webdav." allow="true">
      <host desc="Regex pattern of hostname to allow or deny." allow="true">localhost</host>
      <host desc="Regex pattern of hostname to allow or deny." allow="true">${CLOUD_PUBLIC_DOMAIN}</host>
      <host desc="Regex pattern of hostname to allow or deny." allow="true">${LOOL_PUBLIC_DOMAIN}</host>
      <host desc="Regex pattern of hostname to allow or deny." allow="true">10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}</host>
      <host desc="Regex pattern of hostname to allow or deny." allow="true">172\.1[6789]\.[0-9]{1,3}\.[0-9]{1,3}</host>
      <host desc="Regex pattern of hostname to allow or deny." allow="true">172\.2[0-9]\.[0-9]{1,3}\.[0-9]{1,3}</host>
      <host desc="Regex pattern of hostname to allow or deny." allow="true">172\.3[01]\.[0-9]{1,3}\.[0-9]{1,3}</host>
      <host desc="Regex pattern of hostname to allow or deny." allow="true">192\.168\.[0-9]{1,3}\.[0-9]{1,3}</host>
      <host desc="Regex pattern of hostname to allow or deny." allow="false">192\.168\.1\.1</host>
      <max_file_size desc="Maximum document size in bytes to load. 0 for unlimited." type="uint">${LO_DOC_SIZE}</max_file_size>
    </wopi>
    <webdav desc="Allow/deny webdav storage. Mutually exclusive with wopi." allow="false">
      <host desc="Hostname to allow" allow="false">localhost</host>
    </webdav>
  </storage>

  <tile_cache_persistent desc="Should the tiles persist between two editing sessions of the given document?" type="bool" default="true">true</tile_cache_persistent>
  
  <admin_console desc="Web admin console settings.">
    <username desc="The username of the admin console. Must be set.">${LOOL_ADMIN_NAME}</username>
    <password desc="The password of the admin console. Must be set.">${LOOL_ADMIN_PASSWD}</password>
  </admin_console>
</config>
EOF2

sudo mv ${HOME}/loolwsd.xml ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/loolwsd.xml
sudo chown root.lool ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/loolwsd.xml
sudo chmod 660 ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/loolwsd.xml


while true; do
  read -p "$(tput setaf 1)Do you wish to create and install own openssl Certificates?$(tput sgr 0)" yn
  case $yn in
    [Yy]* ) 
      sudo openssl genrsa -out ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/key.pem 4096
      sudo chown root:lool ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/key.pem
      sudo chmod 640 ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/key.pem

      sudo openssl req -out ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/cert.csr -key ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/key.pem -new -sha256 -nodes -subj "/C=DE/OU=${LOOL_PUBLIC_DOMAIN}/CN=${LOOL_PUBLIC_DOMAIN}/emailAddress=${LOOL_PUBLIC_SA}"
      sudo openssl x509 -req -days 3650 -in ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/cert.csr -signkey ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/key.pem -out ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/cert.pem
      sudo openssl x509 -req -days 3650 -in ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/cert.csr -signkey ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/key.pem -out ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/ca-chain.cert.pem

      sudo chown root:lool ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/cert.csr
      sudo chown root:lool ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/cert.pem
      sudo chown root:lool ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/ca-chain.cert.pem

      sudo chmod 644 ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/cert.csr
      sudo chmod 644 ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/cert.pem
      sudo chmod 644 ${LOOL_PREFIX}/etc/${LOOL_DISTRO}/ca-chain.cert.pem
    ;;
    [Nn]* )
      echo "$(tput setaf 1)Do you have to adapt the file loolwsd.xml so that it can find the certs!$(tput sgr 0)"
      exit 1
    ;;
    * )
      echo "$(tput setaf 1)Please answer yes or no.$(tput sgr 0)"
    ;;
  esac
done

In order to remove the installation you only have only to remove the directory /opt/lool an the service file in /etc/systemd/system/loolwsd.service.

Kind regards, go4ncloud