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';"
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 -
sudo apt install nodejs
Check Node.js version.
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”
Step 2 – Generate SSL Letsencrypt
For this tutorial, we will run the Document Server on the secure HTTPS protocol, and we will generate new SSL certificates from lets encrypt.
Install the Certbot tool for generating SSL Letsencrypt certificates using the apt command below.
sudo apt install certbot
Next, generate new SSL certificates using certbot command below, and make sure to change the domain name and the email address with your own.
certbot certonly --standalone --agree-tos -m email@example.com -d tweenpath.net
Once the certbot command is completed, your SSL certificates will be located at the /etc/letsencrypt/live/tweenpath.net directory And you’ve successfully generated SSL Letsencrypt using the certbot command-line tool.
Step 3 – Running Document Server on HTTPS
In this step, we will secure the Document Server installation with the HTTPS protocol and using the SSL Letsencrypt and dhparam.
By default, the Document Server provided its virtual host configuration for the Nginx web server, located at the ‘/etc/onlyoffice/documentserver/nginx/’ directory.
First, stop the Nginx service using the systemctl command below.
systemctl stop nginx
Now go to the ‘/etc/onlyoffice/documentserver/nginx/’ directory and copy the virtualhost template configuration for the Document Server for SSL ‘ds-ssl.conf.tmpl’ to the ‘ds.conf’.
cd /etc/onlyoffice/documentserver/nginx/ cp ds-ssl.conf.tmpl ds.conf
Now edit the Document Server configuration ‘ds.conf’ using vim editor.
On the ssl_certificate and ssl_certificate_key options, change the path with your SSL certificates path.
ssl_certificate /etc/letsencrypt/live/onlyoffice.hakase-labs.io/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/onlyoffice.hakase-labs.io/privkey.pem;
Save and close. Next, test the Nginx configuration and make sure there is no error, then start the Nginx service.
systemctl restart nginx
As a result, the Document Server is now running on the HTTPS secure connection with the SSL from Letsencrypt.