(Ubuntu 16 TLS) / Debian 8 Jessie +onlyoffice (no docker)

Onlyoffice

Community Edition consists of 3 virtual machines or docker images (1: communityserver, 2: documentserver 3:mailserver) you can run on a single host.

I prefer to use Community Server together with Document Server as it requires less RAM and is more responsive.  Also, you can use Let’s Encrypt for HTTPS and upgrade packages more easily.   Note that Community Server and Document Server must be installed on two different servers (!)

ownCloud / Nextcloud with Document Server

https://api.onlyoffice.com/editors/owncloud

If you simply want to edit documents online using Document Server from inside your ownCloud/NextCloud web server you don’t need the Community Server.

Connect to your owncloud/NextCloud server:

cd .../apps/
git clone https://github.com/ONLYOFFICE/onlyoffice-owncloud.git onlyoffice

You can now configure the link to your Document Server in the settings and edit documents online from inside ownCloud / Nextcloud:

You can find the instructions how to setup a Document Server further down.

Community Server

If you want a more advanced collaboration portal you can use Community Server instead.  It can connect to your ownCloud/ Nextcloud storage and also talk to Document Server for online editing of files.

https://helpcenter.onlyoffice.com/server/linux/community/linux-installation.aspx

System requirements

  • CPU: dual core 2 GHz or better
  • RAM: 2 GB or more
  • HDD: at least 2 GB of free space
  • Additional Requirements: at least 2 GB of swap
  • OS: amd64 Linux distribution with kernel version 3.10 or later
  • Additional Requirements:
  • mono: version 4.2 or later
  • MySQL: version 5.5 or later

At the moment of writing MySQL 5.7 is not yet supported but does work (as long as you have a Mysql root user password set).

Community Server uses mono (version 3.2 or later), nginx and mysql-server as database.

Follow official Mono installation instructions:
http://www.mono-project.com/download/#download-lin-ubuntu

In our case the official instructions say:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF^C
echo "deb http://download.mono-project.com/repo/debian jessie main" | sudo tee /etc/apt/sources.list.d/mono-official.list^C
sudo apt-get update

Next step is to add the onlyoffice repository.
Note that while the package is built against Debian Squeeze, it is compatible with a number of Debian derivatives.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
sudo echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
sudo apt-get update
sudo apt-get install onlyoffice-communityserver

Swap file

sudo swapon --show
free -h
df -h
(ubuntu) sudo fallocate -l 2G /swapfile
(debian) dd if=/dev/zero of=/swapfile bs=2048k count=1000
ls -lh /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
cat /proc/sys/vm/swappiness
sudo sysctl vm.swappiness=10
cat /proc/sys/vm/vfs_cache_pressure
sudo sysctl vm.vfs_cache_pressure=50
sudo vi /etc/sysctl.conf
Append to bottom of the file:
vm.vfs_cache_pressure=50

You can now access the Community server on http://ip-address

If you click on a document to launch the editor, it will not launch.  For that we need a Document Server on another host:

Document Server

https://helpcenter.onlyoffice.com/server/linux/document/linux-installation.aspx

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 2 GB of swap
  • OS:64-bit Debian, Ubuntu 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
  • nodejs: version 6.9.1 or later
  • libstdc++6: version 4.8.4 or later
  • Redis
  • RabbitMQ
echo "deb http://archive.ubuntu.com/ubuntu precise main universe multiverse" | sudo tee -a /etc/apt/sources.list
apt-get update
apt-get install curl
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
sudo apt-get install postgresql
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;"
sudo apt-get install redis-server
sudo apt-get install rabbitmq-server

By default the server will listen on port 80.  If you want to use a different port:

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

Now to install Document Server:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
sudo echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
sudo apt-get update
sudo apt-get install onlyoffice-documentserver

Now you can connect Document Server to Community Server using Community Server web page > Settings > Document Server and update the URL address fields.

Swap File

Same as before.

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 Document Server using secure connection. Please see the details here to learn more on how this can be done.

HTTPS using certbot (Let’s Encrypt)

Locate the link for Nginx on Debian 8 (Jessie) in our case:

https://certbot.eff.org/all-instructions/

The following instructions are courtesy of: https://serenity-networks.com/how-to-install-onlyoffice-document-server-for-nextcloud-fast-easy/

Document Server

sudo echo "deb http://ftp.debian.org/debian jessie-backports main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install certbot -t jessie-backports
certbot certonly --webroot -w /var/www/onlyoffice -d yourdomain.com

This won’t work yet as Nginx is not yet configured to accept Let’s Encrypt ‘acme-challenge’ requests.

The onlyoffice Document Server is running as the ‘supervisor’ service.

service supervisor stop
service nginx stop
cd /etc/nginx/conf.d
cp onlyoffice-documentserver.conf onlyoffice-documentserver.conf.org

This is the new ‘onlyoffice-documentserver.conf’ file.  Modify the areas in bold to your needs.

include /etc/nginx/includes/onlyoffice-http.conf;
## Normal HTTP host
    server {
    listen 0.0.0.0:80;
    listen [::]:80 default_server;
    server_name _;
    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_tokens off;
    root /var/www/html;

    ssl on;
    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.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-Content-Type-Options nosniff;

######  The lines below will allow LetsEncrypt and/or Certbot to obtain & renew SSL certificates
    location ~ /.well-known/acme-challenge {
        root /var/www/onlyoffice/;
        allow all;
    }
    include /etc/nginx/includes/onlyoffice-documentserver-*.conf;
}

This will tell Nginx to use ‘/var/www/onlyoffice/.well-known’ for acme-challenge requests.

service nginx start
service supervisor start
certbot certonly --webroot -w /var/www/onlyoffice -d yourdomain.com

Congratulations! Your certificate and chain have been saved at
/etc/letsencrypt/live/yourdomain.com/fullchain.pem.

The Document Server can now be accessed using HTTPS (port 443).

Community Server

https://helpcenter.onlyoffice.com/server/linux/community/switch-to-https.aspx

sudo service nginx stop

Taken from:
https://github.com/ONLYOFFICE/Docker-CommunityServer/blob/master/config/nginx/onlyoffice-ssl

It is suggested to use the file on the web page, but this is not a good fit and needs significant edits to make it work.

Instead, simply do this:

certbot certonly --webroot -w /var/www/onlyoffice -d yourdomain.com

This currently fails as we need to provide access to the “/var/www/onlyoffice/.wellknown” web folder to serve acme-challenge-response SSL traffic.

This folders looks empty, but is briefly used when an SSL connection is established.

At a later point in time you can monitor the contents of this folder if you are curious.  You can use the following instruction to do so:

while true ; do ls -l .well-known/acme-challenge/ ; sleep 1 ; done

If you type in https://yourdomain.com in your internet browser or run certbot, you should see a SSL challenge-response key file appear here briefly.

Let’s continue enabling HTTPS step by step:

Original Nginx config file

cd /etc/nginx/available-sites
cat onlyoffice
#------------------
upstream fastcgi_backend {
    server unix:/var/run/onlyoffice/onlyoffice.socket;
    server unix:/var/run/onlyoffice/onlyoffice2.socket;
    keepalive 64;
}

fastcgi_cache_path /var/cache/nginx/onlyoffice
    levels=1:2
    keys_zone=onlyoffice:16m
    max_size=256m
    inactive=1d;

server {
    listen 80;
    add_header Access-Control-Allow-Origin *;
    include /etc/nginx/includes/onlyoffice-communityserver-*.conf;
}
#------------------

Certbot compatible Nginx config file

Modify the files as follows:

#------------------
upstream fastcgi_backend {
    server unix:/var/run/onlyoffice/onlyoffice.socket;
    server unix:/var/run/onlyoffice/onlyoffice2.socket;
    keepalive 64;
}

fastcgi_cache_path /var/cache/nginx/onlyoffice
    levels=1:2
    keys_zone=onlyoffice:16m
    max_size=256m
    inactive=1d;

server {
    listen 80;
    add_header Access-Control-Allow-Origin *;
    include /etc/nginx/includes/onlyoffice-communityserver-*.conf;

location ~ ^/.well-known {
        allow all;
    }
}
#------------------

Now we can test certbot again.

sudo service nginx start
certbot certonly --webroot -w /var/www/onlyoffice -d yourdomain.com

Congratulations! Your certificate and chain have been saved at
/etc/letsencrypt/live/yourdomain.com/fullchain.pem.

Now we can complete the steps to enable HTTPS traffic on port 443.

sudo service nginx stop
cat onlyoffice

Modify the file as follows:

#------------------
upstream fastcgi_backend {
    server unix:/var/run/onlyoffice/onlyoffice.socket;
    server unix:/var/run/onlyoffice/onlyoffice2.socket;
    keepalive 64;
 }

fastcgi_cache_path /var/cache/nginx/onlyoffice
    levels=1:2
    keys_zone=onlyoffice:16m
    max_size=256m
    inactive=1d;

## Normal HTTP host
server {
    listen 0.0.0.0:80;
    listen [::]:80 default_server;
    server_name _;
    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-communityserver-*.conf;
 }

## HTTPS host
server {
    listen 0.0.0.0:443 ssl;
    listen [::]:443 ssl default_server;
    server_tokens off;
    root /var/www/html;

    ssl on;
    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
    ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_session_cache builtin:1000 shared:SSL:10m;
    ssl_prefer_server_ciphers on;
    add_header X-Content-Type-Options nosniff;

    include /etc/nginx/includes/onlyoffice-communityserver-*.conf;

    ######  The lines below will allow LetsEncrypt and/or Certbot to obtain & renew SSL certificates
    location ~ ^/.well-known {
        allow all;
    }
}
#------------------

 

(!) The instruction “include /etc/nginx/includes/onlyoffice-communityserver-*.conf;” instruction needs to be placed ABOVE the instruction “location ….well-known” instruction for HTTPS to work.

Congratulations!

You now have Community Server and Document Server running natively on two hosts using Debian 8 Jessie using certbot (Let’s Encrypt) for HTTPS.

Connect to your ownCloud/Nextcloud storage

Now that we have ONLYoffice Community Server up and running, you can ‘map a network drive’ as it were and connect to your ownCloud/Nextcloud storage.  Simply click on the “Connect Nextcloud account’ button and enter the Nextcloud server details:

Server: https://yournextcloudserver.com/remote.php/webdav
Username: Nextcloud user ID
Password: Nextcloud password
Description: The label used to display this connection

Note that the URL address for the Nextcloud server is not 100% identical to the actual server name as we need to connect to the WebDAV interface.

Thank you

If this article was useful to you and you would like us to keep writing articles like these please buy us a beer by visiting https://tablelandscomputers.com/services and click on the ‘Pay Now’ button.

If you need help configuring your server, contact us any time!

Ubuntu 16 TLS + onlyoffice + docker + self signed HTTPS

https://helpcenter.onlyoffice.com/server/docker/opensource/opensource-script-installation.aspx
Ubuntu 16 LTS

wget http://download.onlyoffice.com/install/opensource-install.sh
bash opensource-install.sh -md "yourmailserverdomain.com"

This works but docker needs more resources than a native installation:

System requirements

  • CPU: dual core 2 GHz or better
  • RAM: 6 GB or more
  • HDD: at least 40 GB of free space
  • Additional Requirements: at least 6 GB of swap
  • OS: amd64 Linux distribution with kernel version 3.10 or later

HTTPS – Self signed + docker

cd /app/onlyoffice/CommunityServer/data/certs
openssl genrsa -out onlyoffice.key 2048
openssl req -new -key onlyoffice.key -out onlyoffice.csr
openssl x509 -req -days 365 -in onlyoffice.csr -signkey onlyoffice.key -out onlyoffice.crt
openssl dhparam -out dhparam.pem 2048
reboot

Koozali SME Server 10 – OnlyOffice Community Edition on Centos 7 (docker)

Introduction

ONLYOFFICE is a free, open source corporate office suite developed to organize teamwork online. It’s composed of three separate servers:

  • The Document Server provides users with text, spreadsheet and presentation online editors working within a browser and allowing to co-edit documents in real time, comment and interact using the integrated chat.
  • The Community Server offers a complete set of tools for document, project, customer relation and email correspondence management.
  • The Mail Server is used to create mailboxes using your own domain name.

Because ONLYOFFICE has many moving parts and dependencies, it is recommended to simplify the installation process and avoid dependency errors by deploying ONLYOFFICE using Docker containers.

System requirements

RAM: 8 GB or more
CPU: 2 Core or better
Swap file: at least 8 GB

Docker

Docker installations allow you to run OnlyOffice Community Server:
 # docker images
 REPOSITORY                   TAG                 IMAGE ID            CREATED             SIZE
 onlyoffice/documentserver    4.3.4.10            f5ff5f9ec0c4        2 weeks ago         1.41GB
 onlyoffice/documentserver    latest              f5ff5f9ec0c4        2 weeks ago         1.41GB
 onlyoffice/communityserver   9.0.0.300           d70fbb99a6ee        4 weeks ago         1.32GB
 onlyoffice/communityserver   latest              d70fbb99a6ee        4 weeks ago         1.32GB
 onlyoffice/mailserver        1.6.21              05dd11e787af        5 weeks ago         1.77GB

ONLYoffice Community Edition contains 3 ‘virtual machine’ containers using Docker (communityserver, mailserver, documentserver).  This requires 8GB RAM as the docker images generate some overhead as you can understand.  A native installation requires 2 hosts: 1x Community Server and 1x Document Server.  Native installations allow you to upgrade components more easily and will allow you to use *.pem Let’s Encrypt signed certs.  Native installations also only require 2GB RAM for each node and are quite a bit more responsive.

I have used 2x Debian 8 Jessie to install Community Server and Document Server successfully:
https://tablelandscomputers.com/ubuntu-16-tls-debian-8-onlyoffice-no-docker/

I initially preferred to use Koozali as I love the web admin panel and db commands, but having Apache and Nginx on a single host is asking for problems as you can’t use HTTP port 80 and HTTPS port 443 for both.

Conclusion: It is recommended to run onlyoffice on a ‘clean’ operating system as it will pull in all the packages it needs.

Please find the results of my FAILED ATTEMPT below:

Centos 7 (Koozali SME server 10 alpha)

Things to keep in mind:

  • You need to add yum repositories using Koozali commands.
  • You need to remove MariaDB in favour of MySQL server 5.6
  • You will have Apache and nginx web servers run side-by-side (both wanting to use TCP ports 80 / 443)

Getting started

yum -y install nano yum-utils
yum -y install epel-release

https://wiki.contribs.org/Epel

/sbin/e-smith/db yum_repositories set epel repository \
 Name 'Epel - EL7' \
 BaseURL 'http://download.fedoraproject.org/pub/epel/7/$basearch' \
 MirrorList 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-7&arch=$basearch' \
 EnableGroups no \
 GPGCheck yes \
 GPGKey http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL \
 Exclude perl-Razor-Agent \
 Visible no \
 status disabled

signal-event yum-modify

yum install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

ll /etc/yum.repos.d

mysql-community.repo
mysql-community-source.repo

more mysql-community.repo

Note the various yum repositories in this file.

/sbin/e-smith/db yum_repositories set mysql56-community repository \
 Name 'MySQL 5.6 Community Server' \
 BaseURL 'http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/' \
 EnableGroups no \
 GPGCheck yes \
 GPGKey file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql \
 Visible no \
 status disabled

signal-event yum-modify

yum remove smeserver-horde e-smith-mysql mariadb-server

signal-event post-upgrade

yum install mysql-server –enablerepo mysql56-community

signal-event post-upgrade

nano /etc/my.cnf

[mysqld]
pid-file=/var/run/mysqld/mysqld.pid
basedir=/usr
datadir=/var/lib/mysql
innodb_data_home_dir = /var/lib/mysql/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /var/lib/mysql/
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50

socket=/var/lib/mysql/mysql.sock
skip-networking
max_allowed_packet=16M
user=mysql

[mysqld_safe]

systemctl enable mysqld.service

systemctl start mysqld.service

mysql_upgrade

mysql
mysql> CREATE database onlyoffice;
mysql> CREATE USER ‘onlyoffice’@’localhost’ IDENTIFIED BY ‘yourpasswordhere’;
mysql> GRANT ALL PRIVILEGES ON onlyoffice.* TO ‘onlyoffice’@’localhost’;
mysql> FLUSH PRIVILEGES;
mysql> exit;

/sbin/e-smith/db yum_repositories set onlyoffice repository \
 Name 'onlyoffice' \
 BaseURL 'http://download.onlyoffice.com/repo/centos/main/noarch/' \
 EnableGroups no \
 GPGCheck no \
 Visible no \
 status disabled

signal-event yum-modify

rpm –import “http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF”

yum-config-manager –add-repo http://download.mono-project.com/repo/centos/

yum install onlyoffice-communityserver –enablerepo=onlyoffice epel

signal-event post-upgrade

For now we aim to run the web services using the following TCP/IP port numbers:
80 HTTP  apache (Koozali)
81 HTTP  nginx  (default page)
82 HTTP  nginx  (onlyoffice)
443 HTTPS apache (Koozali)

systemctl enable nginx.service

systemctl stop nginx.service

nano /etc/nginx/conf/nginx.conf

listen 80 default_server;    –>    listen 81 default_server;

nano /etc/nginx/conf/conf.d/onlyoffice.conf

listen 80;    –>     listen 82;

Now we have to edit our server’s firewall rules to open TCP ports for incoming traffic:

db configuration set onlyoffice service
db configuration setprop onlyoffice TCPPorts 81,82
db configuration setprop onlyoffice status enabled
db configuration setprop onlyoffice access public

signal-event remoteaccess-update

sh /var/www/onlyoffice/configure.sh
Configuring MySQL access…
Host: localhost
Database name: onlyoffice
User: onlyoffice
Password: yourpasswordhere
Trying to establish MySQL connection… OK

systemctl start nginx.service

By starting the nginx web server onlyoffice should now be available.

http://ipaddress:80  -> apache primary ibay

http://ipaddress:81  -> nginx default page

http://ipaddress:82  -> Sorry, portal is on maintenance.  It may take a few minutes.

Long story short; this does not work.