Skip to main content
  1. Posts/

Usage of Nextcloud AIO with Microsoft Core Fonts

·696 words·4 mins· 0
Nextcloud self-hosted Docker Collabora
Table of Contents

Preamble #

Nextcloud AIO is the official installation method for Nextcloud. This installation is based on Docker. You just need to deploy one single Container. Nextcloud AIO takes care of the rest.

The problem #

For users common fonts like “Arial”, “Times New Roman” or “Courier” were created and released by Microsoft. That means, that Microsoft has all rights on these fonts. Those must not be deployed or sold without the permission of Microsoft. Therefore, Open Source projects like Collabora Office are forced to exclude them from their products.

Notice: Red Hat has in cooperation with Ascender Corp. (meanwhile Monotype Imaging Holdings Inc. created a set of free fonts (“Liberation”), which are modeled on the fonts of Microsoft. Those are compatible and can be used as a replacement. These fonts are available as a package for Linux distributions (e.g. for Debian “fonts-liberation2”).

Because the master container of Nextcloud AIO controls all other containers, it is unfortunately not possible to define custom volume mappings to make fonts of the host system available to the container. Therefore, the next steps explain how these fonts can still be made available to the container.

Dependencies #

  • up-to-date Linux operating system
  • Server is reachable from the internet
  • configured Domain / Subdomain

Installation #

Docker #

Docker will be installed according to the official documentation corresponding to the operating system. You can skip this step if Docker (including Docker Compose) is already installed.

Nextcloud AIO #

In case you already have an instance of Nextcloud AIO running, you can skip this step.

First, create a new directory in which you want to store all relevant data. You can choose the path freely. For example:

mkdir -p /var/opt/docker/nextcloud-aio
cd /var/opt/docker/nextcloud-aio

Now download the docker-compose file from the GitHub repository

wget https://raw.githubusercontent.com/nextcloud/all-in-one/refs/heads/main/compose.yaml -O docker-compose.yaml

Now the docker-compose.yaml file can be edited and Nextcloud AIO can be configured. For that, the following lines will be changed:

Line 15: remove "# "
Line 23: remove "# " and adjust the path

You can make further changes if you need to.

Nextcloud AIO can now be started:

docker compose up -d

Open the Nextcloud AIO setup via your web browser: https://your.domain.com:8443

Follow the instructions of the installers and activate Collabora Office.

Fonts #

Notice: To install this package, you need to enable the “contrib” component of the Debian package lists. You can check this by executing the following command:

cat /etc/apt/sources.list

If the lines starting with “deb” or “deb-src” contain “contrib”, you can continue. Otherwise add it to the end of the lines and update your package lists via

apt update

The Microsoft fonts will now be installed. Those are usually available via the package manager of the operating system. The name of the package depends on the installed distribution.

Example for Debian:

apt install ttf-mscorefonts-installer -y

After successful installation the fonts are located in the following directory

/usr/share/fonts/truetype/msttcorefonts/

Since changing the container image for Collabora would result in the fonts copied into it being lost, a script is created to copy and restart the container and then executed regularly via cron. Create a new file with the text editor of your choice (vi in this case)

mkdir /root/scripts
vi /root/scripts/collabora_msttcorefonts.sh

Fill in the following content:

#!/bin/bash

docker cp -a /usr/share/fonts/truetype/msttcorefonts/ nextcloud-aio-collabora:/opt/collaboraoffice/share/fonts/truetype/ > /dev/null 2>&1
docker restart nextcloud-aio-collabora > /dev/null 2>&1

Now make the script executable and execute it once to make the fonts available right away.

Attention: This will restart the container and may cause interruptions and possibly data loss if Collabora is actively used at that moment!

chmod 0750 /root/scripts/collabora_msttcorefonts.sh
/root/scripts/collabora_msttcorefonts.sh

To ensure that the fonts are available even after an update, a new cron job is created and executed once a day. You can freely choose the interval and time

crontab -u root -e

0 1 * * * /root/scripts/collabora_msttcorefonts.sh

After an update of Nextcloud AIO and it’s containers you can execute the script manually.

Conclusion #

You installed msttcorefonts on your host system and copied it to the Collabora container for Nextcloud AIO. Besides that, the fonts will be copied automatically into the container on a daily basis to prevent problems after updates.

Fonts in Collabora
msttcorefonts directory:            /usr/share/fonts/truetype/msttcorefonts/
Collabora fonts directory:          /opt/collaboraoffice/share/fonts/truetype/

Docker directory:                   /var/opt/docker/nextcloud-aio/