ONLYOFFICE Document Server comprises web-based viewers and collaborative editors for text documents, spreadsheets, and presentations providing high compatibility with OOXML formats (docx, xlsx, pptx). The suite is distributed under GNU AGPL v3.0.
ONLYOFFICE Document Server can be integrated with various cloud storage platforms like Nextcloud, ownCloud, Seafile, HumHub, Plone, etc., as well as it can be integrated into the solution you're building yourself. Document Server can be used as a part of ONLYOFFICE Community Edition, a free open-source solution with online editors and collaboration platform.
The build_tools allow users to automatically install all necessary components and compile the latest version of the online editors from the source code.
In this tutorial, we’ll learn how to compile ONLYOFFICE Document Server for your Ubuntu installation (64-bit Ubuntu).
System requirements
- CPU: Dual core 2 GHz or better
- RAM: 2 GB or more
- HDD: at least 40 GB of free space
- At least 4 GB of swap
Step 1: Install the dependencies
In case Python and Git are not installed on your computer, install them with the following command:
sudo apt-get install -y python git
Step 2: Build the Document Server source code
Clone the build_tools repository:
git clone https://github.com/ONLYOFFICE/build_tools.git
Go to the appropriate directory:
cd build_tools/tools/linux
Run the script:
./automate.py server
Once done, the Document Server built is available in the ../../out/linux_64/onlyoffice/documentserver/ directory.
Step 3: Install and configure NGINX, PostgreSQL and RabbitMQ
Document Server uses NGINX as a web server and PostgreSQL as a database. RabbitMQ is also required for the correct work.
1. Install and configure NGINX
Install NGINX with this command:
sudo apt-get install nginx
Disable the default website:
sudo rm -f /etc/nginx/sites-enabled/default
Set up the new website. Create the /etc/nginx/sites-available/onlyoffice-documentserver file that contains the following data:
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;
}
location /spellchecker/ {
proxy_pass http://localhost:8080/;
proxy_http_version 1.1;
}
}
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
Restart NGINX:
sudo nginx -s reload
2. Install and configure PostgreSQL
Install PostgreSQL:
sudo apt-get install postgresql
Create the PostgreSQL database and user (enter ‘onlyoffice’ both for user and password):
sudo -i -u postgres psql -c "CREATE DATABASE onlyoffice;"
sudo -i -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"
sudo -i -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"
Configure the database:
psql -hlocalhost -Uonlyoffice -d onlyoffice -f ../../out/linux_64/onlyoffice/documentserver/server/schema/postgresql/createdb.sql
The above command is one line! Enter the ‘onlyoffice’ password when you are asked to provide a password for the onlyoffice PostgreSQL user.
3. Install RabbitMQ
Install RabbitMQ with the following command:
sudo apt-get install rabbitmq-server
Step 4: Generate fonts data
Execute the commands:
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"
Step 5: Generate presentation themes
Run the following commands:
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"
Step 6: Run Document Server
All the components of ONLYOFFICE Document Server run as foreground processes. You need to separate terminal consoles to run them or launch specific tools which allow to run foreground processes in the background mode.
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
Start the SpellChecker service:
cd out/linux_64/onlyoffice/documentserver/server/SpellChecker
NODE_ENV=development-linux NODE_CONFIG_DIR=$PWD/../Common/config ./spellchecker
Start the DocService service:
cd out/linux_64/onlyoffice/documentserver/server/DocService
NODE_ENV=development-linux NODE_CONFIG_DIR=$PWD/../Common/config ./docservice
That’s all! Now you can choose one of the options how to use ONLYOFFICE Document Server (online editors) described in the introduction: integrated with any cloud storage service, or integrated into your own solution, or together with ONLYOFFICE Community Server.