Deploying LibreOffice Online with Docker on Ubuntu

By Anurag Singh

Updated on Aug 19, 2024

Deploying LibreOffice Online with Docker on Ubuntu

In this tutorial, we'll explain how to deploy LibreOffice Online with Docker on Ubuntu 22.04 server.

LibreOffice Online (also known as Collabora Online) is a powerful online office suite with collaborative editing capabilities. This guide will walk you through the steps required to deploy Collabora Online on an Ubuntu server.

Prerequisites

  • An Ubuntu dedicated server or KVM VPS (20.04 or later).
  • Root or sudo access to the server.
  • A domain name pointing to your server's IP address.
  • Basic knowledge of Linux command line.

Step 1: Update Your System

Before starting, ensure your system is up to date:

sudo apt update
sudo apt upgrade -y

Step 2: Install Docker

Collabora Online runs in a Docker container. Install Docker using the following commands:

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Install Docker using following command:

sudo apt install docker.io

Check the Docker installation:

sudo systemctl status docker

Step 3: Install Docker Compose

Docker Compose is a tool for defining and running multi-container Docker applications. Install Docker Compose:

sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep -Po '"tag_name": "\K.*?(?=")')/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

Verify the installation:

docker-compose --version

Step 4: Download and Configure Collabora Online

Create a directory for the Collabora Online Docker configuration:

mkdir ~/collabora
cd ~/collabora

Create a docker-compose.yml file:

nano docker-compose.yml

Add the following configuration to the file:

version: '3.9'

services:
  collabora:
    image: collabora/code
    container_name: collabora
    environment:
      - domain=your.domain.com  # Replace with your actual domain
      - username=admin
      - password=secret         # Replace with a strong password
      - extra_params=--o:ssl.enable=false
    ports:
      - "9980:9980"
    restart: always

Save and close the file (Ctrl+O, Enter, Ctrl+X).

Step 5: Start Collabora Online

Start the Collabora Online container:

sudo docker-compose up -d

Check the status of the container:

sudo docker ps

Step 6: Set Up Reverse Proxy with Nginx

To access Collabora Online through your domain, set up an Nginx reverse proxy. Install Nginx:

sudo apt install nginx -y

Create a new Nginx configuration file:

sudo nano /etc/nginx/sites-available/collabora

Add the following configuration, replacing your.domain.com with your actual domain:

server {
    listen 80;
    server_name your.domain.com;

    location / {
        proxy_pass http://localhost:9980;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Enable the configuration:

sudo ln -s /etc/nginx/sites-available/collabora /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

Step 7: Configure Firewall

We need to configure firewall and add HTTP and HTTPS port.

ufw allow 80/tcp
ufw allow 443/tcp
ufw reload

Step 8: Secure Your Site with Let's Encrypt SSL

Install Certbot, the Let's Encrypt client:

sudo apt install certbot python3-certbot-nginx -y

Obtain and install an SSL certificate:

sudo certbot --nginx -d your.domain.com

Certbot will automatically configure Nginx to use the new SSL certificate. After the process is complete, you should be able to access Collabora Online at https://your.domain.com.

Integrate Collabora Online with Nextcloud

To use Collabora Online with Nextcloud, follow these steps:

Install the Collabora Online app in Nextcloud:

  • Go to the Nextcloud Apps settings.
  • Enable the "Collabora Online" app.

Configure the Collabora Online app:

  • Go to the Nextcloud Admin settings.
  • Open the "Collabora Online" section.
  • Enter the URL of your Collabora Online server (e.g., https://your.domain.com).

Conclusion

You have successfully deployed Collabora Online on your Ubuntu server. Your users can now collaborate on documents in real-time using this powerful online office suite. For further customization and advanced configurations, refer to the Collabora Online documentation.

Feel free to reach out if you have any questions or run into issues!