OnlyOffice installation Ubuntu Linux 20.04.3 +

Introduction

Community Edition allows you to install ONLYOFFICE Docs on your local server and integrate online editors with ONLYOFFICE collaboration platform or other popular systems.

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.

Functionality

  • Document Editor
  • Spreadsheet Editor
  • Presentation Editor
  • Mobile web viewers
  • Collaborative editing
  • Hieroglyph support
  • Support for all the popular formats: DOC, DOCX, TXT, ODT, RTF, ODP, EPUB, ODS, XLS, XLSX, CSV, PPTX, HTML

See the detailed list of features available for ONLYOFFICE Docs Community Edition.

Integrating it with ONLYOFFICE Groups you will be able to:

  • share files;
  • manage access rights to documents;
  • embed documents on a website;
  • view and edit files stored on Drive, Box, Dropbox, OneDrive, OwnCloud connected to ONLYOFFICE.
If you want to use ONLYOFFICE Docs together with ONLYOFFICE Groups, they must be installed on two different machines.

This guide will show you how to install ONLYOFFICE Docs Community Edition Linux version to your machine.

System requirements

  • CPU
    dual core 2 GHz or better
  • RAM
    2 GB or more
  • HDD
    at least 40 GB of free space
  • Additional requirements
    at least 4 GB of swap
  • OS
    64-bit DebianUbuntu or other compatible distribution with kernel version 3.13 or later
  • Additional requirements
    • PostgreSQL: version 9.1 or later
    • NGINX: version 1.3.13 or later
    • libstdc++6: version 4.8.4 or later
    • RabbitMQ

Installing ONLYOFFICE Docs

Installation with Debian based distributives also requires the presence of libstdc++6NGINX and PostgreSQL in the system.

All the necessary instrutions for these components and their dependencies installation can be found at their official websites.

There are other dependencies installed together with ONLYOFFICE Docs:

  • libcurl3
  • libxml2
  • supervisor
  • fonts-dejavu
  • fonts-liberation
  • ttf-mscorefonts-installer
  • fonts-crosextra-carlito
  • fonts-takao-gothic
  • fonts-opensymbol

These dependencies are installed automatically when you use Ubuntu 14.04 LTS or later. Earlier distributions might require their manual installation.

Installing dependencies

ONLYOFFICE Docs uses NGINX and PostgreSQL as database. Dependencies found in the system repository will be installed automatically at ONLYOFFICE Docs installation using the apt-get install command.

Installing and configuring PostgreSQL:

Install the PostgreSQL version included in your version of Ubuntu:

sudo apt-get install postgresql
If you want to install some other PostgreSQL version from the PostgreSQL Repository, please see the official PostgreSQL documentation for more detail on that.

After PostgreSQL is installed, create the PostgreSQL database and user:

The database user must have the onlyoffice name. You can specify any 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;"

Installing rabbitmq:

sudo apt-get install rabbitmq-server
Ubuntu distributives prior to 14.04 LTS might require some other dependencies to be installed.

Ubuntu 18.04 will require to install nginx-extras. This is done using the command:

sudo apt-get install nginx-extras
Changing the default ONLYOFFICE Docs port

By default ONLYOFFICE Docs listens to the incoming connections using port 80. Starting with version 4.3 you can change the port for ONLYOFFICE Docs if you plan to use it instead of the default one.

If you are going to change the default port, make sure that it is open for the incoming/outgoing connections. See the complete list of the ports used by ONLYOFFICE Docs.

To do that you will need to change the default port for the debconf system, running the command:

echo onlyoffice-documentserver onlyoffice/ds-port select <PORT_NUMBER> | sudo debconf-set-selections

Please write the port number instead of the <PORT_NUMBER> in the above command.

WarningIf you want to change the ONLYOFFICE Docs protocol to HTTPS, do not change the port to 443, but use this instruction instead.

There are additional options which can be used for ONLYOFFICE Docs installation. Please read this section for more information on them.

After that you can continue with ONLYOFFICE Docs installation.

Installing ONLYOFFICE Docs

Add GPG key:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5

Add ONLYOFFICE Docs repository:

echo "deb https://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
While the APT package is built against Debian Squeeze, it is compatible with a number of Debian derivatives (including Ubuntu) which means you can use the same repository across all these distributions.

When installing ONLYOFFICE Docs on Debian, add the contrib component to /etc/apt/sources.list. To learn more, you can refer to the Debian documentation.

Update the package manager cache:

sudo apt-get update

Install mscorefonts:

sudo apt-get install ttf-mscorefonts-installer

Install ONLYOFFICE Docs

sudo apt-get install onlyoffice-documentserver
During the installation process, you will be asked to provide a password for the onlyoffice PostgreSQL user. Please enter the onlyoffice password that you have specified when configuring PostgreSQL.

After that ONLYOFFICE Docs will be run as a process. The package will be updated just like any other deb package.

Now you can enter http://localhost in your browser address bar to open the ONLYOFFICE Docs welcome page where you will find further instructions on how to enable document examples or integrate online editors into your web application using the provided API.

To connect ONLYOFFICE Docs to ONLYOFFICE Groups, please refer to this instruction.

Running ONLYOFFICE Docs using HTTPS

In most cases accessing the portal via HTTPS protocol is much more secure than via HTTP which is used by default. You can easily run ONLYOFFICE Docs using secure connection. Please see the details here to learn more on how this can be done.

Introduction

In most cases accessing the portal via HTTPS protocol is much more secure than via HTTP which is used by default. But to change the portal access method certain actions must be performed. Please follow the steps below to find out how to switch your ONLYOFFICE Docs to HTTPS protocol.

Switching ONLYOFFICE Docs to HTTPS using certbot

The easiest way to switch ONLYOFFICE Docs to HTTPS is to automatically get Let’s Encrypt SSL Certificates using certbot.

Install certbot. This process differs depending on the operating system – DEB- or RPM-based. Please choose the corresponding tab to read instructions for your OS:

 

For example, on Ubuntu 20 this can be done with the following commands:

sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot

Once certbot is installed on your machine, run the script specifying your email and domain:

sudo bash /usr/bin/documentserver-letsencrypt.sh email@example.com yourdomain.com

The script will automatically create and install the letsencrypt.org CA-signed certificate to your server and restart the NGINX service for the changes to take effect. Now your ONLYOFFICE Docs should be available at the https://yourdomain.com address.

Switching ONLYOFFICE Docs v5.3 and later to HTTPS

Before you can start to switch your ONLYOFFICE Docs to HTTPS protocol, you will need to create a security certificate and the certificate private key. Put them into a folder on the computer where ONLYOFFICE Docs is installed.

Once you have the certificate, proceed with the steps below:

  1. Stop the NGINX service:
    sudo service nginx stop
  2. Copy the ds-ssl.conf.tmpl file to the ds.conf file using the following command:
    sudo cp -f /etc/onlyoffice/documentserver/nginx/ds-ssl.conf.tmpl /etc/onlyoffice/documentserver/nginx/ds.conf
  3. Edit the /etc/onlyoffice/documentserver/nginx/ds.conf file changing all the parameters in double curly brackets {{…}} for the actually used:
    • {{SSL_CERTIFICATE_PATH}} – the path to the SSL certificate you have got;
    • {{SSL_KEY_PATH}} – the path to the SSL certificate private key;
    • {{SSL_VERIFY_CLIENT}} – whether or not the verification of client certificates is enabled (with available values of onoffoptional and optional_no_ca);
    • {{CA_CERTIFICATES_PATH}} – the path to the client certificate which will be verified if enabled with the previous parameter;
    • {{ONLYOFFICE_HTTPS_HSTS_MAXAGE}} – advanced configuration option for setting the HSTS max-age in the ONLYOFFICE Docs NGINX vHost configuration, and applicable only when SSL is in use (usually defaults to 31536000 which is considered to be safe enough);
    • {{SSL_DHPARAM_PATH}} – the path to the Diffie-Hellman parameter;

    Please see NGINX documentation for more information on SSL parameters used in the configuration file.

  4. When all the changes are made, you can start NGINX service again:
    sudo service nginx start
    Port 443 must be opened for correct portal operation.

Switching ONLYOFFICE Docs v5.2 to HTTPS

To switch ONLYOFFICE Docs v5.2 to HTTPS you need to perform all the steps above paying attention that the second and the third steps will look differently and must be like this:

  1. Copy the onlyoffice-documentserver-ssl.conf.template file to the onlyoffice-documentserver.conf file using the following command:
    sudo cp -f /etc/onlyoffice/documentserver/nginx/onlyoffice-documentserver-ssl.conf.template /etc/onlyoffice/documentserver/nginx/onlyoffice-documentserver.conf
  2. Edit the /etc/onlyoffice/documentserver/nginx/onlyoffice-documentserver.conf file changing all the parameters in double curly brackets {{…}} for the actually used…

Switching ONLYOFFICE Docs v4.3 to 5.1 to HTTPS

To switch ONLYOFFICE Docs v4.3/5.1 to HTTPS you need to perform all the steps above paying attention that the second and the third steps will look differently and must be like this:

  1. Copy the onlyoffice-documentserver-ssl.conf.template file to the onlyoffice-documentserver.conf file using the following command:
    sudo cp -f /etc/onlyoffice/documentserver/nginx/onlyoffice-documentserver-ssl.conf.template /etc/nginx/conf.d/onlyoffice-documentserver.conf
  2. Edit the /etc/nginx/conf.d/onlyoffice-documentserver.conf file changing all the parameters in double curly brackets {{…}} for the actually used…

Switching ONLYOFFICE Docs v3.6 to 4.2 to HTTPS

To switch ONLYOFFICE Docs v3.6/4.2 to HTTPS you need to perform all the steps above paying attention that the second step will look differently and must be like this:

  1. Open the /etc/nginx/conf.d/onlyoffice-documentserver.conf configuration file and delete all its contents. Copy the contents of the SSL config file to your /etc/nginx/conf.d/onlyoffice-documentserver.conf.
    Show the SSL config file contents

    The current actual config file is always available via this link.

Switching ONLYOFFICE Docs v3.5 and older to HTTPS

To switch ONLYOFFICE Docs v3.5/3.0 to HTTPS you need to perform all the steps above paying attention that the second and the third steps will look differently and must be like this:

  1. Open the /etc/nginx/sites-available/onlyoffice-documentserver configuration file and delete all its contents. Go to https://raw.githubusercontent.com/ONLYOFFICE/Docker-DocumentServer/v3.6/config/nginx/onlyoffice-ssl and copy the contents of the SSL config file to your /etc/nginx/sites-available/onlyoffice-documentserver.
  2. Edit the /etc/nginx/sites-available/onlyoffice-documentserver configuration file changing all the parameters in double curly brackets {{…}} for the actually used as described in the instructions above.

Switching ONLYOFFICE Groups to HTTPS

If you have also ONLYOFFICE Groups installed and running together with ONLYOFFICE Docs you will also need to switch it to HTTPS protocol. Read the article to see the details about how to change protocol for ONLYOFFICE Groups.

Additional information: more options for ONLYOFFICE Docs installation

The installation of ONLYOFFICE Docs allows the use of more debconf options which might be very helpful in case you plan installing it to more than one server or in some other cases.

These options include:

  • PostgreSQL database options
    • Set PostgreSQL database host address (replacing <DB_HOST> with the actual address of the PostgreSQL server installed):
      echo onlyoffice-documentserver onlyoffice/db-host string <DB_HOST> | sudo debconf-set-selections
    • Set PostgreSQL database user name (replacing <DB_USER> with the actual name of the user with the appropriate PostgreSQL database rights):
      echo onlyoffice-documentserver onlyoffice/db-user string <DB_USER> | sudo debconf-set-selections
    • Set PostgreSQL database user password (replacing <DB_PASSWORD> with the actual password of the user with the appropriate PostgreSQL database rights):
      echo onlyoffice-documentserver onlyoffice/db-pwd password <DB_PASSWORD> | debconf-set-selections
    • Set PostgreSQL database name (replacing <DB_NAME> with the actual PostgreSQL database name):
      echo onlyoffice-documentserver onlyoffice/db-name string <DB_NAME> | sudo debconf-set-selections
  • RabbitMQ options
    • Set RabbitMQ host address (replacing <RABBITMQ_HOST> with the actual address of RabbitMQ installed):
      echo onlyoffice-documentserver onlyoffice/rabbitmq-host string <RABBITMQ_HOST> | sudo debconf-set-selections
    • Set RabbitMQ user name (replacing <RABBITMQ_USER> with the actual name of the user with the appropriate RabbitMQ rights):
      echo onlyoffice-documentserver onlyoffice/rabbitmq-user string <RABBITMQ_USER> | sudo debconf-set-selections
    • Set RabbitMQ user password (replacing <RABBITMQ_PWD> with the actual password of the user with the appropriate RabbitMQ rights):
      echo onlyoffice-documentserver onlyoffice/rabbitmq-pwd password <RABBITMQ_PWD> | sudo debconf-set-selections
  • JWT options

    You can use debconf-set-selections to disable the overwriting of the custom values in the local.json file after updating ONLYOFFICE Docs.

    • Enable JSON Web Tokens (JWT):
      echo onlyoffice-documentserver onlyoffice/jwt-enabled boolean true | sudo debconf-set-selections
    • Set a JWT secret key replacing <JWT_SECRET> with your own value:
      echo onlyoffice-documentserver onlyoffice/jwt-secret password <JWT_SECRET> | sudo debconf-set-selections

Leave a Reply

Your email address will not be published. Required fields are marked *