Howto install Onlyoffice document server as Nextcloud app


(Markus Neuberger) #1

Module instructions/download:

This howto came out of the discussion from Collaborative Document Editing?, thanks to @danb35, @fausp, @stephdl and everyone I forgot to mention.

EDIT 11.4.2018

  • Package released to fix future upstream documentserver update problems.

EDIT 1.4.2018

  • Due to upstream update problems we shouldn’t use the repo anymore. Now direct package download is done.

EDIT 16.3.2018

  • Module available.

EDIT 6.3.2018

  • With Nextcloud 13 it seems like you need a valid certificate, it doesn’t work with a self-signed cert. Adding 'onlyoffice' => array ( 'verify_peer_off' => TRUE) to /usr/share/nextcloud/config/config.php solves the problem, see this post - thanks to @flatspin

EDIT 11.1.2018

  • Use nodejs from epel instead of installing from source - thanks to @pagaille

EDIT 2.1.2018:

  • Add to hosts without proxy section if using proxy - thanks to @flatspin

We start with installing packages and preparing postgres:

# install packages
yum -y install nethserver-nextcloud nethserver-postgresql nethserver-redis rabbitmq-server nano

# customize postgres pg_hba.conf
mkdir -p /etc/e-smith/templates-custom/var/lib/pgsql/data/pg_hba.conf
echo -e "host all all trust\nhost all all ::1/128 trust" > /etc/e-smith/templates-custom/var/lib/pgsql/data/pg_hba.conf/15onlyoffice
signal-event nethserver-postgresql-update

# create postgres db and user
sudo -u postgres psql -c "CREATE DATABASE onlyoffice;"
sudo -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"
sudo -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"

# start and enable redis and rabbitmq
systemctl enable redis --now
systemctl enable rabbitmq-server --now

# install fonts and documentserver
yum -y install
yum -y install

# stop httpd and start and enable supervisord and nginx
systemctl stop httpd
systemctl enable supervisord --now
systemctl enable nginx --now

# change documentserver http port from 80 to 8081 to have no conflict
export DS_PORT=8081

Now we have to go through the documentserver-configure script. Accept the defaults here. Set the password for Postgres user to “onlyoffice” and the password for RabbitMQ user to “guest”.

[root@testserver ~]#
Configuring PostgreSQL access...
Host: localhost
Database name: onlyoffice
User: onlyoffice
Password: onlyoffice
Trying to establish PostgreSQL connection... OK
Installing PostgreSQL database... OK
Configuring redis access...
Host: localhost
Trying to establish redis connection... OK
Configuring RabbitMQ access...
Host: localhost:5672
User: guest
Password: guest

Now let’s configure nginx:

systemctl stop nginx

# comment out serverblock - this is necessary to prevent nginx from trying to listen on port 80, which will conflict with Apache
sed -i '38,57 s/^ /# /' /etc/nginx/nginx.conf

# create nginx conf for documentserver out of a template
/bin/cp -rf /etc/nginx/conf.d/onlyoffice-documentserver-ssl.conf.template /etc/nginx/conf.d/onlyoffice-documentserver.conf

# change port from 443 to 8082
sed -i '28,29 s/443/8082/' /etc/nginx/conf.d/onlyoffice-documentserver.conf

# add ssl cert config - change if using letsencrypt or own certs
sed -i 's!{{SSL_CERTIFICATE_PATH}}!/etc/pki/tls/certs/localhost.crt!' /etc/nginx/conf.d/onlyoffice-documentserver.conf

# add ssl key config - change if using letsencrypt or own certs
sed -i 's!{{SSL_KEY_PATH}}!/etc/pki/tls/private/localhost.key!' /etc/nginx/conf.d/onlyoffice-documentserver.conf

# add firewall service
config set fw_onlyoffice service status enabled TCPPort 8082 access green
signal-event firewall-adjust

# start services
systemctl start nginx
systemctl start httpd
  • Check if the document server is reachable by browsing to https://neth_fqdn_or_ip:8082. Using certs and respective FQDN is recommended to avoid problems. If you are using self signed certs or IPs you have to allow the documentserver page in your browser else you’ll get an error opening an office document.

  • Log in to Nextcloud as the Nextcloud admin user (by default, that’s username admin, password Nethesis,1234).

  • If you use a second NethServer instance as fw/gateway/proxy with own certs, you have to add the nextcloud-instance to the “hosts without proxy section” on the gateway to make the following steps work. Otherwise you’ll get an error, that nextcloud couldn’t communicate with the download-server.

  • Go to the Apps page. Under Office & text, enable the Onlyoffice app.

  • Then go to the Admin page. Under the ONLYOFFICE heading, in the field for “Document Editing Service address”, fill in https://neth_fqdn_or_ip:8082.
    Leave the other settings at default, or change to your preference. Click Save.

Now you may add a document…

…and edit it:


Collabora Online in Nethserver-Nextcloud
NextCloud / OnlyOffice / Let's Encrypt (Nginx) CA issue
Howto install Odoo 10
Nextcloud13 with onlyoffice error
So, what are you working on? - 8 Jan 18
Collabora intergration
(Ralf Jeckel) #2

Yes man, that is what I was looking for!!!

The HowTo works as expected.
Thank you very much @danb35 for your work, also @fausp and @stephdl .
I wasn’t successful with collabora, but this is much more than just good enough for me!!

One little thing to mention: I use a second NS-instance as fw/gateway/proxy with own certs. To install the onlyoffice-app in nextcloud, I had to add the nextcloud-instance to the “hosts without proxy section” on my gateway. Otherwise I got a failure, that nextcloud couldn’t communicate with the download-server.

(Stéphane de Labrusse) #3

clap, clap @mrmarkuz now a module should be made

(fpausp) #4

How does it work, Is there a howto to make a module ?

(Markus Neuberger) #5

You’ll find some information in the wiki and in the docs, @stephdl has a template with some example code to start with:

(Markus Neuberger) #6

Thanks for testing!

I added it to the howto!

(Markus Neuberger) #7

Don’t know if it would be better to split nginx and onlyoffice like

  • nethserver-nginx: to have nginx setup in NethServer next to apache without port conflicts. I’ve seen some threads about nginx being used for different apps or advanced reverse proxy functions and there’s a feature request too:
  • nethserver-onlyoffice: just to get onlyoffice documentserver integrated - requirement: nethserver-nginx

(fpausp) #8

OK, thank you markus…

(Stéphane de Labrusse) #9

Yes it is better to split nethserver-nginx and nethserver-onlyoffice

(Giacomo Sanchietti) #10

Woooooah! Great work! :clap:

(Alessio Fattorini) #11

Indeed! Markuz great job AGAIN! You’re a :steam_locomotive: :clap: @fausp @danb35 and @stephdl

(Stefano Fancello) #12

Kudos! :clap::clap::clap:

(Matthieu Gaillet) #13

Why not yum install nodejs ?

(Markus Neuberger) #14

You may be right but I didn’t test it. It was a result of copy/paste lazyness :smiley:

(Markus Neuberger) #15

You are right. Thanks, nodejs from epel does the job. I changed the first post.

(Matthieu Gaillet) #16


This what I wait for years. Finally something Users cannot say “no I prefer google” !


(Dan) #17

Because, according to the instruction page at, the package from epel doesn’t install a suitably-recent version. OTOH, it also says that with respect to nginx, and the epel version of nginx is just fine.

(Matthieu Gaillet) #18

OnlyOffice instruction page :

System requirements
Node.js: version 6.9.1 or later

On my system :

Installed Packages
Name        : nodejs
Arch        : x86_64
Epoch       : 1
Version     : 6.12.2
Release     : 1.el7
Size        : 16 M
Repo        : installed
From repo   : epel

Looks like the doc is outdated.

(Dan) #19

So it appears. In that case, even the yum install nodejs isn’t necessary, as it would be pulled in as a dependency of onlyoffice-documentserver.

(Markus Neuberger) #20

Yes, you are right here so I didn’t add it to the yum install line.