How to Integrate OnlyOffice with ownCloud
This tutorial will be showing you how to integrate OnlyOffice with ownCloud. As you may know, OnlyOffice is an open-source online office suite. OnlyOffice team recently released an ownCloud OnlyOffice integration app which allows ownCloud users to edit and collaborate on documents using OnlyOffice online editors.
The integration app features:
- Full-featured text editor available online with all the functionality of desktop editors.
- 100% view, conversion, print and pagination fidelity.
- Add links, tables and charts, insert images, auto shapes, formulas and text objects and manipulate them, create bulleted or numbered lists and more.
- Real-time collaborative editing with your teammates: show changes instantly or after saving only. Use commenting and built-in chat, reviewing and tracking changes.
- Support for most popular formats: edit DOCX, XLSX, PPTX, TXT files and save in ODT, ODS, ODP, DOC, XLS, PPT, PPS, EPUB, RTF, HTML, HTM.
To integrate these two pieces of software, you will need to do the following:
- installing OnlyOffice document server running in HTTPS
- installing the ownCloud OnlyOffice integration app on your ownCloud server.
The OnlyOffice document server and ownCloud server can be installed on two different machines. Let’s get started.
Step 1: Install ONLYOFFICE Document Server
Please note that OnlyOffice document server requires at least 2GB of RAM. An additional 2GB of swap space is recommended. OnlyOffice document server depends on PostgreSQL, Node.js, Redis Server, RabbitMQ server and Nginx. The following steps are tested on a Ubuntu 16.04 server but should also be applicable to other Debian-based Linux distributions.
Install PostgreSQL from Ubuntu repository
sudo apt install postgresql
Then create the onlyoffice
database.
sudo -u postgres psql -c "CREATE DATABASE onlyoffice;"
Create the onlyoffice
user.
sudo -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"
Grant permission.
sudo -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"
Install NodeJS from official repository
OnlyOffice document server requires nodejs 6.9.1+, but the version in Ubuntu repository is outdated, so we will need to install the latest LTS version (6.9.5) of Node.js from upstream repository.
Add Node.js repostiory.
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
Install Node.js.
sudo apt install nodejs
Check Node.js version.
node -v
Sample output:
v6.9.5
Install Redis server and Rabbitmq
sudo apt install redis-server rabbitmq-server
Check their status.
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.
Install OnlyOffice document server
Add OnlyOffice repository with the following command.
echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
Import OnlyOffice public key.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
Update local package index and install OnlyOffice document server. Note that Nginx will be installed as the web server so you might need to stop Apache if it’s running.
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).
Once the installation is finished, enter your server’s public IP address in web browser, you should see “Document Server is running”
Enabling HTTPS
To connect ownCloud to OnlyOffice document server, the latter must be running in HTTPS mode. The following steps show how to obtain and install Let’s Encrypt TLS certificate.
Edit /etc/nginx/conf.d/onlyoffice-documentserver.conf
file.
sudo nano /etc/nginx/conf.d/onlyoffice-documentserver.conf
Change the configuration like below. Don’t forget to set an A record for onlyoffice.your-domain.com
.
include /etc/nginx/includes/onlyoffice-http.conf; server { listen 0.0.0.0:80; listen [::]:80 default_server; server_name onlyoffice.your-domain.com; server_tokens off; include /etc/nginx/includes/onlyoffice-documentserver-*.conf; location ~ /.well-known/acme-challenge { root /var/www/onlyoffice/; allow all; } }
Save and close the file. Reload Nginx
sudo systemctl reload nginx
Then install certbot (Let’s Encrypt) client.
sudo apt install letsencrypt
Next, run the following command to obtain a free TLS certificate using the webroot plugin.
sudo letsencrypt certonly --webroot --agree-tos --email your-email-address -d onlyoffice.your-domain.com -w /var/www/onlyoffice/
Within a few seconds, you shall see a message like below, which means the TLS certificate is successfully obtained.
Edit onlyoffice-documentserver.conf
file.
sudo nano /etc/nginx/conf.d/onlyoffice-documentserver.conf
Delete everything in that file and paste the following text into the file.
include /etc/nginx/includes/onlyoffice-http.conf; ## Normal HTTP host server { listen 0.0.0.0:80; listen [::]:80 default_server; server_name onlyoffice.your-domain.com; server_tokens off; ## Redirects all traffic to the HTTPS host root /nowhere; ## root doesn't have to be a valid path since we are redirecting rewrite ^ https://$host$request_uri? permanent; } #HTTP host for internal services server { listen 127.0.0.1:80; listen [::1]:80; server_name localhost; server_tokens off; include /etc/nginx/includes/onlyoffice-documentserver-common.conf; include /etc/nginx/includes/onlyoffice-documentserver-docservice.conf; } ## HTTPS host server { listen 0.0.0.0:443 ssl; listen [::]:443 ssl default_server; server_name onlyoffice.your-domain.com; server_tokens off; root /usr/share/nginx/html; ssl on; ssl_certificate /etc/letsencrypt/live/onlyoffice.your-domain.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/onlyoffice.your-domain.com/privkey.pem; ssl_ciphers "ECDHE-RSA-AES128-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA128:DHE-RSA-AES128-GCM-SHA384:DHE-RSA-AES128-GCM-SHA128:ECDHE-RSA-AES128-SHA384:ECDHE-RSA-AES128-SHA128:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA384:AES128-GCM-SHA128:AES128-SHA128:AES128-SHA128:AES128-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4"; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_session_cache builtin:1000 shared:SSL:10m; ssl_prefer_server_ciphers on; add_header Strict-Transport-Security max-age=31536000; # add_header X-Frame-Options SAMEORIGIN; add_header X-Content-Type-Options nosniff; ## [Optional] If your certficate has OCSP, enable OCSP stapling to reduce the overhead and latency of running SSL. ## Replace with your ssl_trusted_certificate. For more info see: ## - https://medium.com/devops-programming/4445f4862461 ## - https://www.ruby-forum.com/topic/4419319 ## - https://www.digitalocean.com/community/tutorials/how-to-configure-ocsp-stapling-on-apache-and-nginx # ssl_stapling on; # ssl_stapling_verify on; # ssl_trusted_certificate /etc/nginx/ssl/stapling.trusted.crt; # resolver 208.67.222.222 208.67.222.220 valid=300s; # Can change to your DNS resolver if desired # resolver_timeout 10s; ## [Optional] Generate a stronger DHE parameter: ## cd /etc/ssl/certs ## sudo openssl dhparam -out dhparam.pem 4096 ## #ssl_dhparam {{SSL_DHPARAM_PATH}}; location ~ /.well-known/acme-challenge { root /var/www/onlyoffice/; allow all; } include /etc/nginx/includes/onlyoffice-documentserver-*.conf; }
Save and close the file. Then test Nginx configuration and reload.
sudo nginx -t sudo systemctl reload nginx
Visit https://onlyoffice.your-domain.com
in web browser to verify OnlyOffice document server is running correctly in HTTPS mode.
Step 2: Install ownCloud OnlyOffice Integration App
SSH into your ownCloud server, and then change directory to the ownCloud apps directory.
cd /var/www/owncloud/apps/
Next, download ownCloud ONLYOFFICE integration app using the following command.
sudo git clone https://github.com/ONLYOFFICE/onlyoffice-owncloud.git onlyoffice
Then go to ownCloud Apps page, click Not Enabled
tab and enable the OnlyOffice app.
After that, go to ownCloud admin page, select ONLYOFFICE tab on the left pane and enter your domain name in Document Editing Service Address field.
After saving the above setting, you should be able to create documents, spreedsheets and presentation files within ownCloud.
A separate tab will be opened for editing.
That’s it!
I hope this tutorial helped you with integrating OnlyOffice with ownCloud. As always, if you found this post useful, then subscribe to our free newsletter. You can also follow us on Google+, Twitter or like our Facebook page.
Awesome work. Everything worked perfectly. I followed it to the tee. Except I cannot get into the startup wizard for onlyoffice. Just says Document server is running. Its a Ubuntu 16.04 VPS on digital ocean. I Do have Owncloud 10 with Domain name and Onlyoffice is on a Subdomain. It seems all of the documentation ends after install because the wizard starts on “locahost”. Any ideas? I have been searching OnlyOffice site, seems documentation starts after the Startup wizard. I know its something simple just haven’t found it yet.