Onlyoffice Document Server 설치

Onlyoffice Document Server 설치

Introduction

Document Server 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. This installation guide is designed to give the user the possibility to compile and deploy Document Server from the source codes without any additional help. The guide is intended for the users with the knowledge and skills of Linux OS based server administration.

System requirements

Hardware

  • CPU
    dual core 2 GHz or better
  • RAM
    2 GB or more
  • HDD
    at least 40 GB of free space
  • Additional Requirements
    at least 2 GB of swap

Software

  • OS
    64-bit Debian, Ubuntu or other compatible distribution with kernel version 3.13 or later
  • Compiler with C11 support
All the below actions are described for Ubuntu Server 14.04. Other distributives might require some specific actions not described here.

Installing dependencies

Before you start the compilation, you need to install all the tools and dependencies necessary for the installation and build process. Node.js is installed using the commands:

sudo apt-get install -yq curl apt-transport-https ca-certificates
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
You might also need to install npm and dependencies, depending on your version of Ubuntu. This can be done using the following command:

sudo apt-get install npm

After that update npm running the command:

sudo npm install -g npm

Install grunt:

sudo npm install -g grunt-cli

Most of the other dependencies can be installed using the single command:

sudo apt-get install --force-yes -yq \
    wget \
    build-essential \
    libcurl4-gnutls-dev \
    libglib2.0-dev \
    libgdk-pixbuf2.0-dev \
    libgtkglext1-dev \
    libatk1.0-dev \
    libcairo2-dev \
    libxml2-dev \
    libxss-dev \
    libgconf2-dev \
    default-jre \
    qt5-qmake \
    qt5-default  \
    p7zip-full \
    git \
    subversion

Getting and building Document Server source code

Get the latest version of Document Server source code from GitHub:

git clone --recursive https://github.com/ONLYOFFICE/DocumentServer.git

Switch to the Document Server directory:

cd DocumentServer

Download and build third party modules:

cd core/Common/3dParty && ./make.sh

Now you need to build Document Server components:

  1. Build core:
    cd ../.. && make
  2. Build sdkjs:
    cd ../sdkjs && make
  3. Build server:
    cd ../server && make

Installing and configuring Document Server

Installing dependencies

First install the dependencies necessary for Document Server correct work:

sudo apt-get update
sudo apt-get install adduser redis-server rabbitmq-server nodejs libstdc++6 libcurl3 libxml2 libboost-regex-dev zlib1g fonts-dejavu fonts-liberation ttf-mscorefonts-installer fonts-crosextra-carlito fonts-takao-gothic fonts-opensymbol libxss1 libcairo2 xvfb libxtst6 libgconf2-4 libasound2
Copying Document Server to its folder

Switch to the server folder of Document Server and build and install it using the command:

cd ../server && sudo make install

The built Document Server will be copied to the /var/www/onlyoffice/documentserver/ folder, the onlyoffice user will be created. Also Document Server work folders will be created, the font list and the font thumbnails will be created automatically.

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. 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:
    1. map $http_host $this_host {
    2. "" $host;
    3. default $http_host;
    4. }
    5. map $http_x_forwarded_proto $the_scheme {
    6. default $http_x_forwarded_proto;
    7. "" $scheme;
    8. }
    9. map $http_x_forwarded_host $the_host {
    10. default $http_x_forwarded_host;
    11. "" $this_host;
    12. }
    13. map $http_upgrade $proxy_connection {
    14. default upgrade;
    15. "" close;
    16. }
    17. proxy_set_header Host $http_host;
    18. proxy_set_header Upgrade $http_upgrade;
    19. proxy_set_header Connection $proxy_connection;
    20. proxy_set_header X-Forwarded-Host $the_host;
    21. proxy_set_header X-Forwarded-Proto $the_scheme;
    22. server {
    23. listen 0.0.0.0:80;
    24. listen [::]:80 default_server;
    25. server_tokens off;
    26. rewrite ^\/OfficeWeb(\/apps\/.*)$ /web-apps$1 redirect;
    27. location / {
    28. proxy_pass http://localhost:8000;
    29. proxy_http_version 1.1;
    30. }
    31. location /spellchecker/ {
    32. proxy_pass http://localhost:8080/;
    33. proxy_http_version 1.1;
    34. }
    35. }
  4. Ad 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. 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:

The created database must have 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;"

Run the following command to configure the database:

psql -hlocalhost -Uonlyoffice -d onlyoffice -f /var/www/onlyoffice/documentserver/server/schema/postgresql/createdb.sql
Upon that, you will be asked to provide a password for the onlyoffice PostgreSQL user. Please enter the onlyoffice password.

Running Document Server

All Document Server components run as foreground processes. Thus you need separate terminal consoles to run them or specific tools which will allow to run foreground processes in background mode.
  1. Start the FileConverter service:
    cd /var/www/onlyoffice/documentserver/server/FileConverter/sources/ && export NODE_ENV=production-linux NODE_CONFIG_DIR=/etc/onlyoffice/documentserver && sudo -u onlyoffice -E node /var/www/onlyoffice/documentserver/server/FileConverter/sources/convertermaster.js
  2. And the SpellChecker service:
    export NODE_ENV=production-linux NODE_CONFIG_DIR=/etc/onlyoffice/documentserver && sudo -u onlyoffice -E node /var/www/onlyoffice/documentserver/server/SpellChecker/sources/server.js
  3. After that the DocService:
    export NODE_ENV=production-linux NODE_CONFIG_DIR=/etc/onlyoffice/documentserver && sudo -u onlyoffice -E node /var/www/onlyoffice/documentserver/server/DocService/sources/server.js