Compiling ONLYOFFICE Docs for a local server

Introduction

ONLYOFFICE Docs is an online office suite comprising viewers and editors for text documents, spreadsheets and presentations, fully compatible with Office Open XML formats: .docx, .xlsx, .pptx and enabling collaborative editing in real time.

You can easily compile ONLYOFFICE Docs from source codes and deploy the solution on your local server using the specially designed build_tools. The build_tools allow you to automatically get and install all the components necessary for the compilation process, all the dependencies required for the ONLYOFFICE Docs correct work, as well as to get the latest version of ONLYOFFICE Docs source code and build all its components.

Important We can only guarantee the correct work of the products built from the master branch.
System requirements

Hardware

  • CPU: 4 cores
  • RAM: at least 8 GB, but depends on the host OS. More is better
  • SSD: at least 100 GB of free space
  • SWAP: at least 4 GB, but depends on the host OS. More is better

Software

  • OS: 64-bit Ubuntu 24.04
The solution has been tested on Ubuntu 24.04. Other distributions might require some specific actions, which are not described here.

Installing dependencies

You might need to install Python and Git if they are not yet installed on your computer. This can be done using the following command:

sudo apt-get install -y python3 git

Building ONLYOFFICE Docs source code

  1. Clone the build_tools repository:
    git clone https://github.com/ONLYOFFICE/build_tools.git
  2. Go to the build_tools/tools/linux directory:
    cd build_tools/tools/linux
  3. Run the automate.py script specifying the server parameter to compile the ONLYOFFICE Docs:
    python3 ./automate.py server
    If you run the script without any parameters, this will build ONLYOFFICE Docs alongside with Document Builder and Desktop Editors.
    python3 ./automate.py
    If necessary, you can build several products at once by running the script with the parameters corresponding to the necessary products. To learn more about compiling Document Builder, you can read this article. To learn more about compiling Desktop Editors, please refer to this article.

Wait while the script is being executed. Depending on your computer capabilities, this process may take considerable time. For example, this takes at least 3 hours on 4x2.3GHz vCPUs.

The script will compile all the dependencies and components which are a part of ONLYOFFICE Docs.

The built ONLYOFFICE Docs will be available in the ../../out/linux_64/onlyoffice/documentserver/ directory.

Installing and configuring NGINX

ONLYOFFICE Docs uses NGINX as a web server.

Installing and configuring NGINX
  1. Install NGINX:
    sudo apt-get install nginx
  2. Disable the default website:
    sudo rm -f /etc/nginx/sites-enabled/default
  3. Create the /etc/nginx/sites-available/onlyoffice-documentserver file with the following contents:
    map $http_host $this_host {
      "" $host;
      default $http_host;
    }
    map $http_x_forwarded_proto $the_scheme {
      default $http_x_forwarded_proto;
      "" $scheme;
    }
    map $http_x_forwarded_host $the_host {
      default $http_x_forwarded_host;
      "" $this_host;
    }
    map $http_upgrade $proxy_connection {
      default upgrade;
      "" close;
    }
    proxy_set_header Host $http_host;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $proxy_connection;
    proxy_set_header X-Forwarded-Host $the_host;
    proxy_set_header X-Forwarded-Proto $the_scheme;
    server {
      listen 0.0.0.0:80;
      listen [::]:80 default_server;
      server_tokens off;
      rewrite ^\/OfficeWeb(\/apps\/.*)$ /web-apps$1 redirect;
      location / {
        proxy_pass http://localhost:8000;
        proxy_http_version 1.1;
      }  
    }
  4. Add the symlink to the newly created website to the /etc/nginx/sites-available directory:
    sudo ln -s /etc/nginx/sites-available/onlyoffice-documentserver /etc/nginx/sites-enabled/onlyoffice-documentserver
  5. Restart NGINX to apply the changes:
    sudo nginx -s reload
Generating fonts data
cd out/linux_64/onlyoffice/documentserver/
mkdir fonts
LD_LIBRARY_PATH=${PWD}/server/FileConverter/bin server/tools/allfontsgen \
  --input="${PWD}/core-fonts" \
  --allfonts-web="${PWD}/sdkjs/common/AllFonts.js" \
  --allfonts="${PWD}/server/FileConverter/bin/AllFonts.js" \
  --images="${PWD}/sdkjs/common/Images" \
  --selection="${PWD}/server/FileConverter/bin/font_selection.bin" \
  --output-web='fonts' \
  --use-system="true"
Generating presentation themes
cd out/linux_64/onlyoffice/documentserver/
LD_LIBRARY_PATH=${PWD}/server/FileConverter/bin server/tools/allthemesgen \
  --converter-dir="${PWD}/server/FileConverter/bin"\
  --src="${PWD}/sdkjs/slide/themes"\
  --output="${PWD}/sdkjs/common/Images"

Running ONLYOFFICE Docs

All ONLYOFFICE Docs components run as foreground processes. Thus, you need separate terminal consoles to run them or specific tools which will allow running foreground processes in background mode.
  1. Start the FileConverter service:
    cd out/linux_64/onlyoffice/documentserver/server/FileConverter
    LD_LIBRARY_PATH=$PWD/bin NODE_ENV=development-linux NODE_CONFIG_DIR=$PWD/../Common/config ./converter
  2. Start the DocService service:
    cd out/linux_64/onlyoffice/documentserver/server/DocService
    NODE_ENV=development-linux NODE_CONFIG_DIR=$PWD/../Common/config ./docservice
Article with the tag:
Browse all tags