- Home
- Docs
- Installation and configuration
- Community
- Linux version
- Compiling ONLYOFFICE Docs for a local server
Compiling ONLYOFFICE Docs for a local server
Introduction
ONLYOFFICE Docs is an online office suite comprising viewers and editors for texts, 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 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.
master
branch.System requirements
Hardware
- CPU: dual core 2 GHz or better
- RAM: at least 2 GB, but depends on the host OS. More is better
- HDD: at least 40 GB of free space
- SWAP: at least 4 GB, but depends on the host OS. More is better
Software
- OS: 64-bit Ubuntu 16.04
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 python git
Building ONLYOFFICE Docs source code
- Clone the build_tools repository:
git clone https://github.com/ONLYOFFICE/build_tools.git
- Go to the
build_tools/tools/linux
directory:cd build_tools/tools/linux
- Run the
automate.py
script specifying theserver
parameter to compile the ONLYOFFICE Docs:./automate.py server
If you run the script without any parameters, this will build ONLYOFFICE Docs alongside with Document Builder and Desktop Editors.
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../automate.py
Wait while the script is being executed. Depending on your computer capabilities, this process may take considerable time. For example, this takes 3 hours at least on Intel Core i7-7700
.
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, PostgreSQL and RabbitMQ
ONLYOFFICE Docs uses NGINX
as a web server and PostgreSQL
as a database. RabbitMQ
is also required for ONLYOFFICE Docs to work correctly.
Installing and configuring NGINX
- Install NGINX:
sudo apt-get install nginx
- Disable the default website:
sudo rm -f /etc/nginx/sites-enabled/default
- Now you need to set up the new website. To do that, 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; } }
- 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
- And restart NGINX to apply the changes:
sudo nginx -s reload
Installing and configuring PostgreSQL
Install PostgreSQL using the following command:
sudo apt-get install postgresql
Once PostgreSQL is installed, run the following commands to create the PostgreSQL database and user:
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;"
Run the following command to configure the database:
psql -hlocalhost -Uonlyoffice -d onlyoffice -f ../../out/linux_64/onlyoffice/documentserver/server/schema/postgresql/createdb.sql
onlyoffice
PostgreSQL user. Please enter the onlyoffice
password.Installing RabbitMQ
Install RabbitMQ using the following command:
sudo apt-get install rabbitmq-server
Generate 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"
Generate 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
- 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 DocService service:
cd out/linux_64/onlyoffice/documentserver/server/DocService
NODE_ENV=development-linux NODE_CONFIG_DIR=$PWD/../Common/config ./docservice