Install OnlyOffice 7 on Ubuntu 22

Install OnlyOffice Document Server on Ubuntu

OnlyOffice document server depends on PostgreSQL, Node.js, Redis Server, RabbitMQ server and Nginx. The following steps are tested on a Ubuntu 22.04 server but should also be applicable to Linux distributions in the Debian family.

Install PostgreSQL on Ubuntu

PostgreSQL is available from the default Ubuntu repository. The PostgreSQL team always strives to make performance improvements with every new version. Run the following commands to install the latest version of PostgreSQL from the repository.

echo "deb [signed-by=/etc/apt/keyrings/postgresql.asc] $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo mkdir -p /etc/apt/keyrings/
wget --quiet -O - | sudo tee /etc/apt/keyrings/postgresql.asc
sudo apt update
sudo apt install -y postgresql postgresql-contrib postgresql-15 postgresql-client-15
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;"

Note: Both the username and password must be onlyoffice.

Install NodeJS from official repository

OnlyOffice document server requires nodejs version 14.0+, but the version in Ubuntu repository is outdated, so we will need to install Node.js from upstream repository.

curl -sL | sudo -E bash -
sudo apt install nodejs -y

Check Node.js version.

node -v

Install Redis server and Rabbitmq

sudo apt install redis-server rabbitmq-server

Enable them on boot-

systemctl enable postgresql
systemctl enable redis-server
systemctl enable rabbitmq-server

Check their status-

systemctl status postgresql
systemctl status redis-server
systemctl status rabbitmq-server

You should see they are active (running). If rabbitmq-server failed to start, that’s mostly because of low memory on the machine or invalid hostname. Redis server listens on RabbitMQ listens on and

Install OnlyOffice document server

Add OnlyOffice repository with the following command. (You might be wondering if it’s ok to use the Debian squeeze repository on Ubuntu. Don’t worry. This OnlyOffice repository is meant for all Debian and Ubuntu releases.)

echo "deb squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
sudo apt-key adv --keyserver hkp:// --recv-keys CB2DE8E5

Update local package index and install OnlyOffice document server. Note that the onlyoffice-documentserver package will install nginx-extras as a dependency, so if an Apache web server is running, you need to stop it first.

sudo apt update
sudo apt install onlyoffice-documentserver

During the installation process, you will be asked to enter PostgreSQL password for onlyoffice. Enter “onlyoffice” (without double quotes). You also need to accept the Microsoft license terms in order to install TrueType core fonts from Microsoft.

An Nginx server block will be installed as /etc/nginx/conf.d/ds.conf. (It’s actually a symbolic link to /etc/onlyoffice/documentserver/nginx/ds.conf.) The OnlyOffice document server is a nodejs web application and Nginx acts as the reverse proxy. /var/www/onlyoffice/documentserver/ is the web root directory.

Once the installation is finished, enter your server’s public IP address in a web browser, and you should see “ONLYOFFICE Docs Community Edition installed”

To check the version number of the document server, you can use the following command.

apt search onlyoffice-documentserver

Sample output.

onlyoffice-documentserver/squeeze,now 7.2.1-23 amd64 [installed]
Online editors for text documents, spreadsheets, and presentations

If you encounter the following error during installation, it might be that there’s an error in your Nginx configuration files. Run sudo nginx -t to find out.

dpkg: error processing package onlyoffice-documentserver (--configure):
installed onlyoffice-documentserver package post-installation script subprocess returned error exit status 1
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Enabling HTTPS for the Document Server

To connect WordPress to OnlyOffice document server, the latter must be running in HTTPS mode (Both the WordPress server and user browsers will need to make contact with document server). The following steps show how to obtain and install Let’s Encrypt TLS certificate.

First, we need to edit the OnlyOffice Nginx server block file.

sudo nano /etc/nginx/conf.d/ds.conf

We add a server_name directive like below. Don’t forget to set DNS A record for

include /etc/nginx/includes/http-common.conf;
server {
listen [::]:80 default_server;
server_tokens off;

include /etc/nginx/includes/ds-*.conf;

Save and close the file. Reload Nginx for the changes to take effect.

sudo systemctl reload nginx

Then install certbot (Let’s Encrypt) client and the Nginx plugin.

sudo apt install certbot python3-certbot-nginx

Next, run the following command to obtain a free TLS certificate using the Nginx plugin.

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email -d


--nginx: Use the nginx plugin.
--agree-tos: Agree to terms of service.
--redirect: Force HTTPS by 301 redirect.
--hsts: Add the Strict-Transport-Security header to every HTTP response. Forcing browser to always use TLS for the domain. Defends against SSL/TLS Stripping.
--staple-ocsp: Enables OCSP Stapling. A valid OCSP response is stapled to the certificate that the server offers during TLS.

Within a few seconds, you shall see a message like below, which means the TLS certificate is successfully obtained.

Visit in web browser to verify OnlyOffice document server is running correctly in HTTPS mode.


How to Integrate OnlyOffice with WordPress on Ubuntu Server

Install ONLYOFFICE Document Server with Nginx on Debian 10


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.